From b64c3d9944383a53621acbe5b8509de928d63621 Mon Sep 17 00:00:00 2001 From: Alexander Andreev Date: Sat, 21 Feb 2026 15:05:04 +0300 Subject: [PATCH] Public: reorder detail badges and fix comment count grammar --- index.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index 01af69c..464f950 100644 --- a/index.php +++ b/index.php @@ -255,6 +255,21 @@ $catalogOverviewCountLabel = count($photos) . ' фото'; function h(string $v): string { return htmlspecialchars($v, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); } function assetUrl(string $path): string { $f=__DIR__ . '/' . ltrim($path,'/'); $v=is_file($f)?(string)filemtime($f):(string)time(); return $path . '?v=' . rawurlencode($v); } function limitText(string $text, int $len): string { return function_exists('mb_substr') ? mb_substr($text, 0, $len) : substr($text, 0, $len); } +function commentCountLabel(int $count): string +{ + $mod100 = $count % 100; + $mod10 = $count % 10; + if ($mod100 >= 11 && $mod100 <= 14) { + return $count . ' комментариев'; + } + if ($mod10 === 1) { + return $count . ' комментарий'; + } + if ($mod10 >= 2 && $mod10 <= 4) { + return $count . ' комментария'; + } + return $count . ' комментариев'; +} function buildTopicTreePublic(array $topics): array { @@ -595,8 +610,8 @@ function outputWatermarked(string $path, string $mime): never 0): ?>
- 0): ?>
комментариев
Есть улучшенная версия
+ 0): ?>