From 19ccad0890d0ba3b5cab6cf7baf5f4f9ce6ff0f5 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Sun, 3 May 2026 10:34:24 +0000 Subject: [PATCH] update sales list --- pages/sales_purchases_logic.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/pages/sales_purchases_logic.php b/pages/sales_purchases_logic.php index e47a240..72b9ab1 100644 --- a/pages/sales_purchases_logic.php +++ b/pages/sales_purchases_logic.php @@ -1,5 +1,27 @@ (string)($page ?? ''), + 'requested_limit' => isset($_GET['limit']) ? (string)$_GET['limit'] : 'unset', + 'applied_limit' => 20, + ]); + } + if (function_exists('app_debug_file_log')) { + app_debug_file_log( + 'runtime_debug.log', + date('Y-m-d H:i:s') . " [sales_purchases_limit_fallback] page=" . (string)($page ?? '') + . " requested_limit=" . (isset($_GET['limit']) ? (string)$_GET['limit'] : 'unset') + . " applied_limit=20" + ); + } + } + $limit = min(500, max(5, $requestedLimit > 0 ? $requestedLimit : 20)); + $page_num = isset($page_num) ? max(1, (int)$page_num) : (isset($_GET['p']) ? max(1, (int)$_GET['p']) : 1); + $offset = ($page_num - 1) * $limit; + $type = ($page === 'sales') ? 'sale' : 'purchase'; $table = ($type === 'purchase') ? 'purchases' : 'invoices'; $cust_supplier_col = ($type === 'purchase') ? 'supplier_id' : 'customer_id';