diff --git a/public_html/auditoria.php b/public_html/auditoria.php index 3993365..de782f0 100644 --- a/public_html/auditoria.php +++ b/public_html/auditoria.php @@ -5,12 +5,18 @@ declare(strict_types=1); require __DIR__ . '/../src/bootstrap.php'; Auth::requireAdmin(); -$perPage = 50; +$perPageOptions = [10, 25, 50, 100]; +$perPage = (int) ($_GET['per'] ?? 50); +if (!in_array($perPage, $perPageOptions, true)) { + $perPage = 50; +} +$total = (int) Database::pdo()->query('SELECT COUNT(*) FROM audit_log')->fetchColumn(); +$totalPages = max(1, (int) ceil($total / $perPage)); + $page = max(1, (int) ($_GET['p'] ?? 1)); +$page = min($page, $totalPages); $offset = ($page - 1) * $perPage; -$total = (int) Database::pdo()->query('SELECT COUNT(*) FROM audit_log')->fetchColumn(); - $stmt = Database::pdo()->prepare( 'SELECT * FROM audit_log ORDER BY criado_em DESC, id DESC LIMIT :limit OFFSET :offset' ); @@ -19,8 +25,6 @@ $stmt->bindValue('offset', $offset, PDO::PARAM_INT); $stmt->execute(); $logs = $stmt->fetchAll(); -$totalPages = max(1, (int) ceil($total / $perPage)); - $acaoLabels = [ 'login' => 'Login', 'login_negado' => 'Login negado (sem permissão)', @@ -42,9 +46,23 @@ View::header('Auditoria');

Auditoria

Histórico de logins (inclusive tentativas com senha incorreta), alterações em - alunos, administradores e configurações. Mostrando de registros. + alunos, administradores e configurações.

+
+ + Mostrando de registros — página de + +
+ + +
+
+ @@ -70,16 +88,29 @@ View::header('Auditoria');
Data/hora
1): ?> -

- - - - - - - | - -

+
+ 1): ?> + ← Anterior + + ← Anterior + + +
+ + + +
+ + + Próxima → + + Próxima → + +