From 93ba22c8d4bc6b4d4e2ce26099448f2d3bb02b42 Mon Sep 17 00:00:00 2001 From: Thomas Hochstein Date: Sat, 11 Apr 2020 12:47:55 +0200 Subject: [PATCH] Don't fallback to last page if $totalPages < 1. See #693 for context. That should at least avoid SQL errors. Signed-off-by: Thomas Hochstein --- include/functions_entries.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/functions_entries.inc.php b/include/functions_entries.inc.php index 17d6e54b..a1e315ef 100644 --- a/include/functions_entries.inc.php +++ b/include/functions_entries.inc.php @@ -412,7 +412,7 @@ function &serendipity_fetchEntries($range = null, $full = true, $limit = '', $fe // Do not allow requesting a page that doesn't exist // and do a fallback to the highest page number available - if ($serendipity['GET']['page'] > $totalPages) { + if ($totalPages > 0 && $serendipity['GET']['page'] > $totalPages) { $serendipity['GET']['page'] = $totalPages; }