From 101f4c539afa0f2533f749681fd20bfe2f006523 Mon Sep 17 00:00:00 2001 From: Yasen Pramatarov Date: Sun, 13 Apr 2025 19:49:47 +0300 Subject: [PATCH] Validates pagination vars --- app/templates/pagination.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/templates/pagination.php b/app/templates/pagination.php index 02b6f44..52f16a0 100644 --- a/app/templates/pagination.php +++ b/app/templates/pagination.php @@ -6,11 +6,14 @@ * $totalPages - Total number of pages */ -// Ensure required variables are set +// Validate required pagination variables if (!isset($currentPage) || !isset($totalPages)) { return; } +// Ensure valid values +$currentPage = max(1, min($currentPage, $totalPages)); + // Number of page links to show before and after current page $range = 2; ?>