Validates pagination vars

main
Yasen Pramatarov 2025-04-13 19:49:47 +03:00
parent 522cded113
commit 101f4c539a
1 changed files with 4 additions and 1 deletions

View File

@ -6,11 +6,14 @@
* $totalPages - Total number of pages * $totalPages - Total number of pages
*/ */
// Ensure required variables are set // Validate required pagination variables
if (!isset($currentPage) || !isset($totalPages)) { if (!isset($currentPage) || !isset($totalPages)) {
return; return;
} }
// Ensure valid values
$currentPage = max(1, min($currentPage, $totalPages));
// Number of page links to show before and after current page // Number of page links to show before and after current page
$range = 2; $range = 2;
?> ?>