From f5063a6eda49d2a35b2aed486f86cde76e0f04a8 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 24 Mar 2012 15:06:13 +0100 Subject: [PATCH] [ticket/10714] Add incorrect offset calculation in view_log function PHPBB3-10714 --- phpBB/includes/functions_admin.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index e05ed3cdde..fd1f5568ab 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2584,9 +2584,13 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id return 0; } - if ($offset >= $log_count) + if ($log_count) { - $offset = ($offset - $limit < 0) ? 0 : $offset - $limit; + // Return the user to the last page that is valid + while ($offset >= $log_count) + { + $offset = ($offset - $limit < 0) ? 0 : $offset - $limit; + } } $sql = "SELECT l.*, u.username, u.username_clean, u.user_colour