From 459e8dc09522d8e54ce82182a99ebddf2362a737 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 26 Feb 2012 02:15:39 +0100 Subject: [ticket/10532] Get rid of inline calculation of $start, remove duplicated check PHPBB3-10532 --- phpBB/search.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/phpBB/search.php b/phpBB/search.php index 87e40832a5..3006c0e5d9 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -505,10 +505,15 @@ if ($keywords || $author || $author_id || $search_id || $submit) } // Make sure $start is set to the last page if it exceeds the amount - if ($start < 0 || $start >= $total_match_count) + if ($start < 0) { - $start = ($start < 0) ? 0 : floor(($total_match_count - 1) / $per_page) * $per_page; + $start = 0; } + else if ($start >= $total_match_count) + { + $start = floor(($total_match_count - 1) / $per_page) * $per_page; + } + $id_ary = array_slice($id_ary, $start, $per_page); } else -- cgit v1.2.1