v1.6.28 : drill-down IP par AS dans stats pays, suppression Répartition par réseau
- Admin stats : clic sur un réseau AS affiche les IPs avec mini sparkline 14 jours + articles/livres consultés - AccessLogParser : calcul ip_data (daily + top paths) inclus dans le cache stats - Suppression du tableau statique "Répartition par réseau" (fusionné dans accordéon pays) - PHP-CS-Fixer appliqué sur l'ensemble des fichiers modifiés Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,10 +4,8 @@ $_statsError = ($_GET['error'] ?? '') === 'write';
|
||||
$_readable = $adminData['stats_readable'] ?? false;
|
||||
$_books = $adminData['stats_books'] ?? [];
|
||||
$_asList = $adminData['stats_as'] ?? [];
|
||||
$_asGroups = $adminData['stats_as_groups'] ?? [];
|
||||
$_groups = $adminData['as_groups'] ?? [];
|
||||
$_pagesByDay = $adminData['stats_pages_by_day'] ?? [];
|
||||
$_activeGroup = trim($_GET['group'] ?? '');
|
||||
$_ipData = $adminData['stats_ip_data'] ?? [];
|
||||
?>
|
||||
|
||||
<?php if ($_statsSaved): ?>
|
||||
@@ -27,7 +25,8 @@ $_activeGroup = trim($_GET['group'] ?? '');
|
||||
|
||||
<script>
|
||||
var FOLIO_PAGES_BY_DAY = <?= json_encode($_pagesByDay, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ?>;
|
||||
var FOLIO_AS_LIST = <?= json_encode($_asList, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ?>;
|
||||
var FOLIO_AS_LIST = <?= json_encode($_asList, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ?>;
|
||||
var FOLIO_IP_DATA = <?= json_encode($_ipData, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ?>;
|
||||
</script>
|
||||
|
||||
<div class="card mb-4">
|
||||
@@ -98,73 +97,6 @@ var FOLIO_AS_LIST = <?= json_encode($_asList, JSON_UNESCAPED_SLASHES |
|
||||
|
||||
</div><!-- /row -->
|
||||
|
||||
<!-- Répartition par réseau -->
|
||||
<div class="card mt-4">
|
||||
<div class="card-header bg-transparent py-2 small fw-semibold d-flex align-items-center gap-3 flex-wrap">
|
||||
<span>Répartition par réseau</span>
|
||||
<?php if (!empty($_groups)): ?>
|
||||
<div class="d-flex gap-1 flex-wrap">
|
||||
<a href="/admin/stats" class="badge <?= $_activeGroup === '' ? 'bg-primary' : 'bg-secondary' ?> text-decoration-none">Tous</a>
|
||||
<?php foreach ($_groups as $g): ?>
|
||||
<a href="/admin/stats?group=<?= rawurlencode($g['label']) ?>"
|
||||
class="badge <?= $_activeGroup === $g['label'] ? 'bg-primary' : 'bg-secondary' ?> text-decoration-none">
|
||||
<?= htmlspecialchars($g['label']) ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
<a href="/admin/stats?group=Autres"
|
||||
class="badge <?= $_activeGroup === 'Autres' ? 'bg-primary' : 'bg-secondary' ?> text-decoration-none">Autres</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<?php
|
||||
// Sélectionner les AS à afficher
|
||||
if ($_activeGroup !== '' && isset($_asGroups[$_activeGroup])) {
|
||||
$displayAs = $_asGroups[$_activeGroup];
|
||||
} else {
|
||||
$displayAs = $_asList;
|
||||
}
|
||||
?>
|
||||
<?php if (empty($displayAs)): ?>
|
||||
<p class="text-muted p-3 mb-0">
|
||||
<?= empty($_asList) ? 'Aucune IP résolue (LAN ou logs vides).' : 'Aucun AS dans ce groupe.' ?>
|
||||
</p>
|
||||
<?php else: ?>
|
||||
<?php $maxAS = max(array_column($displayAs, 'hits')) ?: 1; ?>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-hover mb-0 small">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th class="ps-3" style="width:2rem">#</th>
|
||||
<th>Réseau</th>
|
||||
<th style="width:3rem">Pays</th>
|
||||
<th style="width:5rem" class="text-end pe-3">Visites</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($displayAs as $i => $as): ?>
|
||||
<tr>
|
||||
<td class="text-muted ps-3"><?= $i + 1 ?></td>
|
||||
<td>
|
||||
<span class="fw-medium"><?= htmlspecialchars($as['name'] ?: '?') ?></span>
|
||||
<?php if ($as['asn'] !== ''): ?>
|
||||
<span class="text-muted ms-1">AS<?= htmlspecialchars($as['asn']) ?></span>
|
||||
<?php endif; ?>
|
||||
<div class="progress mt-1" style="height:3px">
|
||||
<div class="progress-bar bg-info" style="width:<?= round($as['hits'] / $maxAS * 100) ?>%"></div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-muted"><?= htmlspecialchars($as['country']) ?></td>
|
||||
<td class="text-end fw-semibold pe-3"><?= number_format($as['hits'], 0, ',', '\u{202F}') ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php endif; // readable?>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user