diff --git a/my_listings.php b/my_listings.php
index b81b1ac..8945fd5 100644
--- a/my_listings.php
+++ b/my_listings.php
@@ -4,7 +4,14 @@ session_start();
require_once 'db/config.php'; // Include the database configuration
// Pagination constants
-const ITEMS_PER_PAGE = 6;
+ $items_per_page = isset($_GET['items_per_page']) ? (int)$_GET['items_per_page'] : 6;
+ // Validate $items_per_page to be a positive integer, e.g., 6, 12, 24, 48
+ if (!in_array($items_per_page, [6, 12, 24, 48])) {
+ $items_per_page = 6; // Default to 6 if invalid value is provided
+ }
+
+ // Pagination constants
+ // const ITEMS_PER_PAGE = 6;
// If user is not logged in or not a vendor, redirect
if (!isset($_SESSION['user_id']) || $_SESSION['user_role'] !== 'vendor') {
@@ -40,7 +47,7 @@ $items = []; // Initialize an empty array to hold items
$total_stmt->execute($total_items_params);
$total_items = $total_stmt->fetchColumn();
- $total_pages = ceil($total_items / ITEMS_PER_PAGE);
+ $total_pages = ceil($total_items / $items_per_page);
$current_page = isset($_GET['page']) ? (int)$_GET['page'] : 1;
$current_page = max(1, min($current_page, $total_pages == 0 ? 1 : $total_pages)); // Ensure current page is within valid range
@@ -90,7 +97,7 @@ $items = []; // Initialize an empty array to hold items
$query .= $orderBy;
$query .= " LIMIT ? OFFSET ?";
- $query_params[] = ITEMS_PER_PAGE;
+ $query_params[] = $items_per_page;
$query_params[] = $offset;
$stmt = $pdo->prepare($query);
@@ -137,7 +144,14 @@ $items = []; // Initialize an empty array to hold items
+
+ Clear Filters