From 2c35ccc19963f577120ea5be93b2dcf6a3612f2d Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Tue, 20 Jan 2026 21:36:42 -0500 Subject: [PATCH] fix: Add table alias to COUNT query for advanced filters The WHERE conditions use 't.' prefix but the COUNT query was missing the table alias, causing 500 errors when using priority_max, assigned_to, or date filters. Co-Authored-By: Claude Opus 4.5 --- models/TicketModel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/TicketModel.php b/models/TicketModel.php index f759da8..312eb03 100644 --- a/models/TicketModel.php +++ b/models/TicketModel.php @@ -172,7 +172,7 @@ class TicketModel { $sortDirection = strtolower($sortDirection) === 'asc' ? 'ASC' : 'DESC'; // Get total count for pagination - $countSql = "SELECT COUNT(*) as total FROM tickets $whereClause"; + $countSql = "SELECT COUNT(*) as total FROM tickets t $whereClause"; $countStmt = $this->conn->prepare($countSql); if (!empty($params)) {