diff --git a/inc/mod/pages.php b/inc/mod/pages.php
index eb981076..625a66e6 100644
--- a/inc/mod/pages.php
+++ b/inc/mod/pages.php
@@ -2892,15 +2892,18 @@ function mod_reports() {
if (!hasPermission($config['mod']['reports']))
error($config['error']['noaccess']);
+ $reports_limit = $config['mod']['recent_reports'];
+
$query = prepare("SELECT * FROM ``reports`` ORDER BY `time` DESC LIMIT :limit");
- $query->bindValue(':limit', $config['mod']['recent_reports'], PDO::PARAM_INT);
+ $query->bindValue(':limit', $reports_limit + 1, PDO::PARAM_INT);
$query->execute() or error(db_error($query));
$reports = $query->fetchAll(PDO::FETCH_ASSOC);
$report_queries = [];
foreach ($reports as $report) {
- if (!isset($report_queries[$report['board']]))
+ if (!isset($report_queries[$report['board']])) {
$report_queries[$report['board']] = [];
+ }
$report_queries[$report['board']][] = $report['post'];
}
@@ -2908,7 +2911,7 @@ function mod_reports() {
foreach ($report_queries as $board => $posts) {
$report_posts[$board] = [];
- $query = query(sprintf('SELECT * FROM ``posts_%s`` WHERE `id` = ' . implode(' OR `id` = ', $posts), $board)) or error(db_error());
+ $query = query(\sprintf('SELECT * FROM ``posts_%s`` WHERE `id` = ' . \implode(' OR `id` = ', $posts), $board)) or error(db_error());
while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
$report_posts[$board][$post['id']] = $post;
}
@@ -2951,23 +2954,24 @@ function mod_reports() {
// Bug fix for https://github.com/savetheinternet/Tinyboard/issues/21
$po->body = truncate($po->body, $po->link(), $config['body_truncate'] - substr_count($append_html, '
'));
- if (mb_strlen($po->body) + mb_strlen($append_html) > $config['body_truncate_char']) {
+ if (\mb_strlen($po->body) + \mb_strlen($append_html) > $config['body_truncate_char']) {
// still too long; temporarily increase limit in the config
$__old_body_truncate_char = $config['body_truncate_char'];
- $config['body_truncate_char'] = mb_strlen($po->body) + mb_strlen($append_html);
+ $config['body_truncate_char'] = \mb_strlen($po->body) + \mb_strlen($append_html);
}
$po->body .= $append_html;
$body .= $po->build(true) . '