pages.php: better input validation in recent_posts page

This commit is contained in:
Zankaria 2025-04-14 17:48:05 +02:00
parent 26c6cb0330
commit 66e44b01c7

View File

@ -2668,8 +2668,20 @@ function mod_recent_posts(Context $ctx, $lim) {
if (!hasPermission($config['mod']['recent']))
error($config['error']['noaccess']);
$limit = (is_numeric($lim))? $lim : 25;
$last_time = (isset($_GET['last']) && is_numeric($_GET['last'])) ? $_GET['last'] : 0;
$limit = 25;
if (\is_numeric($lim)) {
$lim = \intval($lim);
if ($lim > 0 && $lim < 1000) {
$limit = $lim;
}
}
$last_time = 0;
if (isset($_GET['last']) && \is_numeric($_GET['last'])) {
$last = \intval($_GET['last']);
if ($last > 0) {
$last_time = $last;
}
}
$mod_boards = [];
$boards = listBoards();