mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 05:20:56 +02:00
Merge branch 'develop-olympus' into develop
* develop-olympus: [ticket/5506] Do not display an empty last page after deleting logs.
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user