diff --git a/client/activity.php b/client/activity.php index 3e64725b2..04348808a 100644 --- a/client/activity.php +++ b/client/activity.php @@ -4,6 +4,10 @@ * Everything this contact has done in the portal, and every sign-in */ +// Read by client/includes/header.php and footer.php - see the note there. +// Must be set before inc_all.php, which pulls the header in. +$portal_load_datatables = true; + header("Content-Security-Policy: default-src 'self'"); require_once "includes/inc_all.php"; @@ -13,33 +17,26 @@ require_once "includes/inc_all.php"; * not a section of the portal. Scoped on log_user_id - the portal user this * contact signs in as - so an agent working this client never appears here, * and on log_client_id as a second fence. + * + * DataTables searches and paginates in the browser, so the whole set is sent at + * once rather than a page at a time. The cap is there so that a contact with + * years of history cannot turn this page into a several-megabyte document; it + * is generous enough that nobody normal will meet it, and the note below says + * so plainly when they do. */ -$page = intval($_GET['page'] ?? 1); -if ($page < 1) { - $page = 1; -} - -$records_per_page = 25; -$offset = ($page - 1) * $records_per_page; +$activity_limit = 1000; $log_scope = "log_user_id = $session_user_id AND log_client_id = $session_client_id"; $row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT(log_id) AS total FROM logs WHERE $log_scope")); $total_records = intval($row['total']); -$total_pages = (int) ceil($total_records / $records_per_page); - -// A page number past the end would show nothing at all with no way back -if ($total_pages > 0 && $page > $total_pages) { - $page = $total_pages; - $offset = ($page - 1) * $records_per_page; -} $sql_activity = mysqli_query( $mysqli, "SELECT log_action, log_created_at, log_description, log_ip, log_type FROM logs WHERE $log_scope ORDER BY log_id DESC - LIMIT $records_per_page OFFSET $offset" + LIMIT $activity_limit" ); ?> @@ -59,10 +56,15 @@ $sql_activity = mysqli_query( -
| When | + +When | Type | What happened | From | @@ -107,25 +109,11 @@ $sql_activity = mysqli_query(
|---|