diff options
| author | Simon Rettberg | 2025-08-05 15:16:33 +0200 |
|---|---|---|
| committer | Simon Rettberg | 2025-08-05 15:16:33 +0200 |
| commit | 14d2617c8f3cd7c88dc01787f67f03ae04e8aa9d (patch) | |
| tree | 320dc7c5a626c7522a71fc5ab76a23b7cc77666e | |
| parent | [session] Show pointer when over audit payload data (diff) | |
| download | slx-admin-14d2617c8f3cd7c88dc01787f67f03ae04e8aa9d.tar.gz slx-admin-14d2617c8f3cd7c88dc01787f67f03ae04e8aa9d.tar.xz slx-admin-14d2617c8f3cd7c88dc01787f67f03ae04e8aa9d.zip | |
[session] audit: Use pagination
| -rw-r--r-- | modules-available/session/page.inc.php | 12 | ||||
| -rw-r--r-- | modules-available/session/templates/audit-list.html | 2 |
2 files changed, 9 insertions, 5 deletions
diff --git a/modules-available/session/page.inc.php b/modules-available/session/page.inc.php index d113f523..9ec04dd8 100644 --- a/modules-available/session/page.inc.php +++ b/modules-available/session/page.inc.php @@ -117,14 +117,15 @@ class Page_Session extends Page } $username = $row['login']; } - $res = Database::queryAll("SELECT u.userid, u.login, + $lines = array(); + $paginate = new Paginate("SELECT u.userid, u.login, a.action, a.dateline, a.ipaddr, a.data, a.module, a.response FROM audit a LEFT JOIN user u USING (userid) $extra - ORDER BY dateline DESC - LIMIT 500", $args); - foreach ($res as &$row) { + ORDER BY dateline DESC", 50); + $res = $paginate->exec($args); + foreach ($res as $row) { $row['dateline_s'] = Util::prettyTime($row['dateline']); if ($row['response'] < 200 || $row['response'] >= 400) { $row['class'] = 'text-danger slx-bold'; @@ -132,8 +133,9 @@ class Page_Session extends Page if ($username !== null) { unset($row['login']); } + $lines[] = $row; } - Render::addTemplate('audit-list', ['list' => $res, 'user' => $username]); + $paginate->render('audit-list', ['list' => $lines, 'user' => $username]); } } diff --git a/modules-available/session/templates/audit-list.html b/modules-available/session/templates/audit-list.html index 081e1593..e389137b 100644 --- a/modules-available/session/templates/audit-list.html +++ b/modules-available/session/templates/audit-list.html @@ -13,6 +13,7 @@ </p> {{/user}} +{{{pagenav}}} <table class="table"> <tr> <th>{{lang_when}}</th> @@ -38,6 +39,7 @@ </tr> {{/list}} </table> +{{{pagenav}}} <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog modal-lg"> |
