";
// Header row with Expand All button
echo "";
// Config for stale-while-refresh stats snapshot updates (no visible table overwrite).
echo '
';
// Flow layout for stats cards
echo "
";
// Redirects Statistics Card
$redirectStats = (is_array($statsData) && isset($statsData['redirects']) && is_array($statsData['redirects']))
? $statsData['redirects']
: array();
$auto301 = intval($redirectStats['auto301'] ?? 0);
$auto302 = intval($redirectStats['auto302'] ?? 0);
$manual301 = intval($redirectStats['manual301'] ?? 0);
$manual302 = intval($redirectStats['manual302'] ?? 0);
$trashed = intval($redirectStats['trashed'] ?? 0);
$total = $auto301 + $auto302 + $manual301 + $manual302 + $trashed;
$content = ABJ_404_Solution_Functions::readFileContents(__DIR__ . "/html/statsRedirectsBox.html");
// In Simple mode, replace technical "301"/"302" labels with plain language
if ($this->logic->getSettingsMode() === 'simple') {
$content = $this->f->str_replace('{Automatic 301 Redirects}', esc_html__('Automatic Permanent Redirects', '404-solution'), $content);
$content = $this->f->str_replace('{Automatic 302 Redirects}', esc_html__('Automatic Temporary Redirects', '404-solution'), $content);
$content = $this->f->str_replace('{Manual 301 Redirects}', esc_html__('Manual Permanent Redirects', '404-solution'), $content);
$content = $this->f->str_replace('{Manual 302 Redirects}', esc_html__('Manual Temporary Redirects', '404-solution'), $content);
}
$content = $this->f->str_replace('{auto301}', esc_html((string)$auto301), $content);
$content = $this->f->str_replace('{auto302}', esc_html((string)$auto302), $content);
$content = $this->f->str_replace('{manual301}', esc_html((string)$manual301), $content);
$content = $this->f->str_replace('{manual302}', esc_html((string)$manual302), $content);
$content = $this->f->str_replace('{trashed}', esc_html((string)$trashed), $content);
$content = $this->f->str_replace('{total}', esc_html((string)$total), $content);
$content = $this->f->doNormalReplacements($content);
$abj404view->echoOptionsSection('stats-redirects', 'abj404-redirectStats', __('Redirects', '404-solution'), $content, true, $abj404view->getCardIcon('chart'));
// Captured URLs Statistics Card
$capturedStats = (is_array($statsData) && isset($statsData['captured']) && is_array($statsData['captured']))
? $statsData['captured']
: array();
$captured = intval($capturedStats['captured'] ?? 0);
$ignored = intval($capturedStats['ignored'] ?? 0);
$trashed = intval($capturedStats['trashed'] ?? 0);
$total = $captured + $ignored + $trashed;
$content = ABJ_404_Solution_Functions::readFileContents(__DIR__ . "/html/statsCapturedURLsBox.html");
$content = $this->f->str_replace('{captured}', esc_html((string)$captured), $content);
$content = $this->f->str_replace('{ignored}', esc_html((string)$ignored), $content);
$content = $this->f->str_replace('{trashed}', esc_html((string)$trashed), $content);
$content = $this->f->str_replace('{total}', esc_html((string)$total), $content);
$content = $this->f->doNormalReplacements($content);
$abj404view->echoOptionsSection('stats-captured', 'abj404-capturedStats', __('Captured URLs', '404-solution'), $content, true, $abj404view->getCardIcon('warning'));
// Periodic Stats Cards
$periodicStats = (is_array($statsData) && isset($statsData['periods']) && is_array($statsData['periods']))
? $statsData['periods']
: array();
$periodMeta = array(
array('title' => __("Today's Stats", '404-solution'), 'key' => 'today'),
array('title' => __("This Month", '404-solution'), 'key' => 'month'),
array('title' => __("This Year", '404-solution'), 'key' => 'year'),
array('title' => __("All Stats", '404-solution'), 'key' => 'all'),
);
for ($x = 0; $x <= 3; $x++) {
$title = $periodMeta[$x]['title'];
$periodKey = $periodMeta[$x]['key'];
$periodStats = (is_array($periodicStats) && isset($periodicStats[$periodKey]) && is_array($periodicStats[$periodKey]))
? $periodicStats[$periodKey]
: array();
$disp404 = intval($periodStats['disp404'] ?? 0);
$distinct404 = intval($periodStats['distinct404'] ?? 0);
$visitors404 = intval($periodStats['visitors404'] ?? 0);
$refer404 = intval($periodStats['refer404'] ?? 0);
$redirected = intval($periodStats['redirected'] ?? 0);
$distinctredirected = intval($periodStats['distinctredirected'] ?? 0);
$distinctvisitors = intval($periodStats['distinctvisitors'] ?? 0);
$distinctrefer = intval($periodStats['distinctrefer'] ?? 0);
$content = ABJ_404_Solution_Functions::readFileContents(__DIR__ . "/html/statsPeriodicBox.html");
$content = $this->f->str_replace('{disp404}', esc_html((string)$disp404), $content);
$content = $this->f->str_replace('{distinct404}', esc_html((string)$distinct404), $content);
$content = $this->f->str_replace('{visitors404}', esc_html((string)$visitors404), $content);
$content = $this->f->str_replace('{refer404}', esc_html((string)$refer404), $content);
$content = $this->f->str_replace('{redirected}', esc_html((string)$redirected), $content);
$content = $this->f->str_replace('{distinctredirected}', esc_html((string)$distinctredirected), $content);
$content = $this->f->str_replace('{distinctvisitors}', esc_html((string)$distinctvisitors), $content);
$content = $this->f->str_replace('{distinctrefer}', esc_html((string)$distinctrefer), $content);
$content = $this->f->doNormalReplacements($content);
$abj404view->echoOptionsSection('stats-periodic-' . $x, 'abj404-stats' . $x, $title, $content, ($x == 0), $abj404view->getCardIcon('clock'));
}
echo "
"; // Close flow layout
// Match Confidence distribution card (full-width)
$this->echoConfidenceDistributionSection();
// Trend Analytics section (full-width, below the flow layout cards)
$this->echoTrendsSection();
// Broken Internal Links section
$this->echoBrokenInternalLinksSection();
echo "