diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4cba74f..738df10 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,14 @@ Format : [Keep a Changelog](https://keepachangelog.com/fr/1.0.0/) — versionnag
---
+## [1.6.34] - 2026-05-19
+
+### Ajouté
+- AccessLogParser : calcul des visiteurs uniques par article (IPs non-bot publiques, /post/ statut 200) sur 7 / 14 / 30 jours — stocké dans `data/UUID/visitors.json`
+- Page article : affichage du nombre de lecteurs (7 / 14 / 30 jours) dans la zone hero, recalculé à chaque visite de `/admin/stats`
+
+---
+
## [1.6.33] - 2026-05-19
### Ajouté
diff --git a/public/index.php b/public/index.php
index deacb50..6cc9963 100644
--- a/public/index.php
+++ b/public/index.php
@@ -896,6 +896,13 @@ switch ($action) {
$bookContext['next_article'] = $bookContext['next'] !== null ? $articles->getBySlug($bookContext['next']) : null;
}
+ $articleVisitors = [];
+ $_visFile = DATA_PATH . '/' . ($article['uuid'] ?? '') . '/visitors.json';
+ if (($article['uuid'] ?? '') !== '' && is_file($_visFile)) {
+ $articleVisitors = json_decode((string) file_get_contents($_visFile), true) ?: [];
+ }
+ unset($_visFile);
+
include BASE_PATH . '/templates/post_view.php';
break;
@@ -2785,13 +2792,14 @@ switch ($action) {
}
$statsRaw = [
- 'readable' => $accessParser->isReadable(),
- 'books' => $tParser->top($cutoff14, 20, ['/book/']),
- 'as' => AsnLookup::aggregateByAs($topIps, $asnMap),
- 'pages_by_day' => $accessStats['pages_by_day'] ?? [],
- 'ip_data' => $ipData,
- 'all_uas' => $accessStats['all_uas'] ?? [],
- 'unique_visitors' => $accessStats['unique_visitors'] ?? [7 => 0, 14 => 0, 30 => 0],
+ 'readable' => $accessParser->isReadable(),
+ 'books' => $tParser->top($cutoff14, 20, ['/book/']),
+ 'as' => AsnLookup::aggregateByAs($topIps, $asnMap),
+ 'pages_by_day' => $accessStats['pages_by_day'] ?? [],
+ 'ip_data' => $ipData,
+ 'all_uas' => $accessStats['all_uas'] ?? [],
+ 'unique_visitors' => $accessStats['unique_visitors'] ?? [7 => 0, 14 => 0, 30 => 0],
+ 'article_unique_visitors' => $accessStats['article_unique_visitors'] ?? [],
];
@file_put_contents($statsCacheFile, json_encode($statsRaw));
}
@@ -2805,6 +2813,22 @@ switch ($action) {
$adminData['stats_all_uas'] = $statsRaw['all_uas'] ?? [];
$adminData['stats_unique_visitors'] = $statsRaw['unique_visitors'] ?? [7 => 0, 14 => 0, 30 => 0];
+ // Écriture des visitors.json par article (slug → UUID via l'index)
+ $_slugIndex = is_file(DATA_PATH . '/_cache/slug_index.json')
+ ? (json_decode((string) file_get_contents(DATA_PATH . '/_cache/slug_index.json'), true) ?: [])
+ : [];
+ foreach (($statsRaw['article_unique_visitors'] ?? []) as $_artPath => $_artCounts) {
+ $_artSlug = rawurldecode(substr((string) $_artPath, 6));
+ $_artUuid = $_slugIndex[$_artSlug] ?? null;
+ if ($_artUuid !== null && preg_match('/^[0-9a-f\-]{36}$/i', $_artUuid)) {
+ @file_put_contents(
+ DATA_PATH . '/' . $_artUuid . '/visitors.json',
+ json_encode(array_merge($_artCounts, ['updated' => time()]), JSON_UNESCAPED_UNICODE)
+ );
+ }
+ }
+ unset($_slugIndex, $_artPath, $_artCounts, $_artSlug, $_artUuid);
+
// AS exclus (chargé en direct, pas mis en cache)
$excludedAsFile = DATA_PATH . '/excluded_as.json';
$adminData['excluded_as'] = is_file($excludedAsFile)
diff --git a/public/version.txt b/public/version.txt
index 7337a93..d8462d4 100644
--- a/public/version.txt
+++ b/public/version.txt
@@ -1 +1 @@
-1.6.33
+1.6.34
diff --git a/src/AccessLogParser.php b/src/AccessLogParser.php
index d822641..80219cd 100644
--- a/src/AccessLogParser.php
+++ b/src/AccessLogParser.php
@@ -10,7 +10,14 @@ class AccessLogParser
private int $cacheTtl;
private int $days;
/** @var list
= htmlspecialchars($modDate) ?>
+ + = number_format($_v30, 0, ',', "\xE2\x80\xAF") ?> lecteurs · 30 j + (= $_v14 ?> / 14 j · = $_v7 ?> / 7 j) + +
+