From b73eb367f2572ad7971e2775c233dd501aa642c0 Mon Sep 17 00:00:00 2001 From: onli Date: Fri, 27 Mar 2015 00:00:10 +0100 Subject: [PATCH] Prevent negative offset (#321) --- 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 67b3cc24..17503c4f 100644 --- a/include/functions_entries.inc.php +++ b/include/functions_entries.inc.php @@ -405,7 +405,7 @@ function &serendipity_fetchEntries($range = null, $full = true, $limit = '', $fe } else if ($serendipity['GET']['page'] == $totalPages - 1) { $limit = serendipity_db_limit($limit, ($totalEntries - (($totalPages -2) * $limit)) - $limit); } else { - $limit = serendipity_db_limit(($totalEntries - ($limit * $serendipity['GET']['page'])), $limit); + $limit = serendipity_db_limit(max(0, ($totalEntries - ($limit * $serendipity['GET']['page']))), $limit); } } else { $limit = serendipity_db_limit(($serendipity['GET']['page']-1) * $limit, $limit);