From c4e4196e0204cc6cd12553da534291a463cc82a7 Mon Sep 17 00:00:00 2001 From: Hosteroid Date: Mon, 20 Oct 2025 19:53:28 +0300 Subject: [PATCH] Refactor stats variable names for clarity Renamed generic 'stats' variables to more specific names such as 'domainStats', 'errorStats', 'tldStats', and 'importStats' across controllers and views. This improves code readability and reduces ambiguity when handling different types of statistics in the application. --- app/Controllers/ErrorLogController.php | 4 ++-- app/Controllers/TldRegistryController.php | 6 +++--- app/Views/dashboard/index.php | 18 +++++++++--------- app/Views/errors/admin-index.php | 8 ++++---- app/Views/layout/base.php | 6 +++--- app/Views/layout/sidebar.php | 8 ++++---- app/Views/tld-registry/import-logs.php | 10 +++++----- app/Views/tld-registry/index.php | 10 +++++----- 8 files changed, 35 insertions(+), 35 deletions(-) diff --git a/app/Controllers/ErrorLogController.php b/app/Controllers/ErrorLogController.php index 0758f70..371f988 100644 --- a/app/Controllers/ErrorLogController.php +++ b/app/Controllers/ErrorLogController.php @@ -41,7 +41,7 @@ class ErrorLogController extends Controller $errors = $this->errorLogModel->getPaginatedErrors($filters, $perPage, $offset); // Get statistics using model - $stats = $this->errorLogModel->getAdminStats(); + $errorStats = $this->errorLogModel->getAdminStats(); // Pagination data $totalPages = ceil($totalErrors / $perPage); @@ -54,7 +54,7 @@ class ErrorLogController extends Controller 'showing_to' => min($offset + $perPage, $totalErrors) ]; - $this->view('errors/admin-index', compact('errors', 'stats', 'filters', 'pagination')); + $this->view('errors/admin-index', compact('errors', 'errorStats', 'filters', 'pagination')); } /** diff --git a/app/Controllers/TldRegistryController.php b/app/Controllers/TldRegistryController.php index b2de78d..73b74fc 100644 --- a/app/Controllers/TldRegistryController.php +++ b/app/Controllers/TldRegistryController.php @@ -37,12 +37,12 @@ class TldRegistryController extends Controller $order = $_GET['order'] ?? 'asc'; $result = $this->tldModel->getPaginated($page, $perPage, $search, $sort, $order, $status, $dataType); - $stats = $this->tldModel->getStatistics(); + $tldStats = $this->tldModel->getStatistics(); $this->view('tld-registry/index', [ 'tlds' => $result['tlds'], 'pagination' => $result['pagination'], - 'stats' => $stats, + 'tldStats' => $tldStats, 'filters' => [ 'search' => $search, 'status' => $status, @@ -584,7 +584,7 @@ class TldRegistryController extends Controller $this->view('tld-registry/import-logs', [ 'imports' => $result['logs'], 'pagination' => $result['pagination'], - 'stats' => $importStats, + 'importStats' => $importStats, 'title' => 'TLD Import Logs' ]); } diff --git a/app/Views/dashboard/index.php b/app/Views/dashboard/index.php index 8f1871f..a27f897 100644 --- a/app/Views/dashboard/index.php +++ b/app/Views/dashboard/index.php @@ -4,9 +4,9 @@ $pageTitle = 'Dashboard Overview'; $pageDescription = 'Monitor your domains and expiration dates'; $pageIcon = 'fas fa-chart-line'; -// Get stats for dashboard (if not already set by base.php) -if (!isset($stats)) { - $stats = \App\Helpers\LayoutHelper::getDomainStats(); +// Get domain stats for dashboard (if not already set by base.php) +if (!isset($domainStats)) { + $domainStats = \App\Helpers\LayoutHelper::getDomainStats(); } ob_start(); @@ -19,7 +19,7 @@ ob_start();

Total Domains

-

+

@@ -32,7 +32,7 @@ ob_start();

Active

-

+

@@ -45,8 +45,8 @@ ob_start();

Expiring Soon

-

-

within days

+

+

within days

@@ -59,7 +59,7 @@ ob_start();

Inactive

-

+

@@ -261,7 +261,7 @@ ob_start();

No domains expiring soon

-

within days

+

within days

diff --git a/app/Views/errors/admin-index.php b/app/Views/errors/admin-index.php index 02fcaaa..de2129c 100644 --- a/app/Views/errors/admin-index.php +++ b/app/Views/errors/admin-index.php @@ -34,7 +34,7 @@ $currentFilters = $filters ?? ['resolved' => '', 'type' => '', 'sort' => 'last_o

Total Errors

-

+

@@ -47,7 +47,7 @@ $currentFilters = $filters ?? ['resolved' => '', 'type' => '', 'sort' => 'last_o

Unresolved

-

+

@@ -60,7 +60,7 @@ $currentFilters = $filters ?? ['resolved' => '', 'type' => '', 'sort' => 'last_o

Last 24h

-

+

@@ -73,7 +73,7 @@ $currentFilters = $filters ?? ['resolved' => '', 'type' => '', 'sort' => 'last_o

Occurrences

-

+

diff --git a/app/Views/layout/base.php b/app/Views/layout/base.php index 30d02b8..5fd240a 100644 --- a/app/Views/layout/base.php +++ b/app/Views/layout/base.php @@ -17,9 +17,9 @@ if ($userId) { $unreadNotifications = 0; } -// Get stats for sidebar (available on all pages) -if (!isset($stats)) { - $stats = \App\Helpers\LayoutHelper::getDomainStats(); +// Get domain stats for sidebar (available on all pages) +if (!isset($domainStats)) { + $domainStats = \App\Helpers\LayoutHelper::getDomainStats(); } // Get application settings from database diff --git a/app/Views/layout/sidebar.php b/app/Views/layout/sidebar.php index eb3a37d..62fcc49 100644 --- a/app/Views/layout/sidebar.php +++ b/app/Views/layout/sidebar.php @@ -84,7 +84,7 @@
Total
- +
@@ -94,9 +94,9 @@
- Expiring + Expiring
- +
@@ -108,7 +108,7 @@
Active
- +
diff --git a/app/Views/tld-registry/import-logs.php b/app/Views/tld-registry/import-logs.php index 58945d0..88f453e 100644 --- a/app/Views/tld-registry/import-logs.php +++ b/app/Views/tld-registry/import-logs.php @@ -27,7 +27,7 @@ ob_start();

Total Imports

-

+

@@ -40,7 +40,7 @@ ob_start();

Successful

-

+

@@ -53,7 +53,7 @@ ob_start();

Failed

-

+

@@ -67,8 +67,8 @@ ob_start();

Last Import

- - + + Never diff --git a/app/Views/tld-registry/index.php b/app/Views/tld-registry/index.php index 33d8f7f..b5c4a3a 100644 --- a/app/Views/tld-registry/index.php +++ b/app/Views/tld-registry/index.php @@ -37,7 +37,7 @@ $currentFilters = $filters ?? ['search' => '', 'sort' => 'tld', 'order' => 'asc'

- @@ -69,7 +69,7 @@ $currentFilters = $filters ?? ['search' => '', 'sort' => 'tld', 'order' => 'asc'

Total TLDs

-

+

@@ -82,7 +82,7 @@ $currentFilters = $filters ?? ['search' => '', 'sort' => 'tld', 'order' => 'asc'

Active

-

+

@@ -95,7 +95,7 @@ $currentFilters = $filters ?? ['search' => '', 'sort' => 'tld', 'order' => 'asc'

With RDAP

-

+

@@ -108,7 +108,7 @@ $currentFilters = $filters ?? ['search' => '', 'sort' => 'tld', 'order' => 'asc'

With WHOIS

-

+