aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_admin.php
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2011-07-16 21:00:14 -0400
committerNils Adermann <naderman@naderman.de>2011-07-16 21:00:14 -0400
commit6f851d89aaade2f89fe81c6c046a06eadddf2a31 (patch)
tree7b087035a314fcaed80319e6b88e99139ea776d8 /phpBB/includes/functions_admin.php
parentb876a1ff2063f1bcc88d35500643b0ec78ba9beb (diff)
parent83f955a2c5d7cae354a2844a16d32b17d3781afe (diff)
downloadforums-6f851d89aaade2f89fe81c6c046a06eadddf2a31.tar
forums-6f851d89aaade2f89fe81c6c046a06eadddf2a31.tar.gz
forums-6f851d89aaade2f89fe81c6c046a06eadddf2a31.tar.bz2
forums-6f851d89aaade2f89fe81c6c046a06eadddf2a31.tar.xz
forums-6f851d89aaade2f89fe81c6c046a06eadddf2a31.zip
Merge branch 'develop-olympus' into develop
* develop-olympus: [ticket/5506] Do not display an empty last page after deleting logs.
Diffstat (limited to 'phpBB/includes/functions_admin.php')
-rw-r--r--phpBB/includes/functions_admin.php47
1 files changed, 32 insertions, 15 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index ee59d77cdb..71f8ab572e 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -2596,6 +2596,31 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
$sql_keywords .= 'LOWER(l.log_data) ' . implode(' OR LOWER(l.log_data) ', $keywords) . ')';
}
+ if ($log_count !== false)
+ {
+ $sql = 'SELECT COUNT(l.log_id) AS total_entries
+ FROM ' . LOG_TABLE . ' l, ' . USERS_TABLE . " u
+ WHERE l.log_type = $log_type
+ AND l.user_id = u.user_id
+ AND l.log_time >= $limit_days
+ $sql_keywords
+ $sql_forum";
+ $result = $db->sql_query($sql);
+ $log_count = (int) $db->sql_fetchfield('total_entries');
+ $db->sql_freeresult($result);
+ }
+
+ if ($log_count == 0)
+ {
+ // Save the queries, because there are no logs to display
+ return 0;
+ }
+
+ if ($offset >= $log_count)
+ {
+ $offset = ($offset - $limit < 0) ? 0 : $offset - $limit;
+ }
+
$sql = "SELECT l.*, u.username, u.username_clean, u.user_colour
FROM " . LOG_TABLE . " l, " . USERS_TABLE . " u
WHERE l.log_type = $log_type
@@ -2743,21 +2768,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
}
}
- if ($log_count !== false)
- {
- $sql = 'SELECT COUNT(l.log_id) AS total_entries
- FROM ' . LOG_TABLE . ' l, ' . USERS_TABLE . " u
- WHERE l.log_type = $log_type
- AND l.user_id = u.user_id
- AND l.log_time >= $limit_days
- $sql_keywords
- $sql_forum";
- $result = $db->sql_query($sql);
- $log_count = (int) $db->sql_fetchfield('total_entries');
- $db->sql_freeresult($result);
- }
-
- return;
+ return $offset;
}
/**
@@ -2889,6 +2900,12 @@ function view_inactive_users(&$users, &$user_count, $limit = 0, $offset = 0, $li
$user_count = (int) $db->sql_fetchfield('user_count');
$db->sql_freeresult($result);
+ if ($user_count == 0)
+ {
+ // Save the queries, because there are no users to display
+ return 0;
+ }
+
if ($offset >= $user_count)
{
$offset = ($offset - $limit < 0) ? 0 : $offset - $limit;