diff --git a/src/Controller/TorrentController.php b/src/Controller/TorrentController.php index cc6bb6a..078bad9 100644 --- a/src/Controller/TorrentController.php +++ b/src/Controller/TorrentController.php @@ -262,16 +262,26 @@ class TorrentController extends AbstractController // Generate keywords by extension $keywords = []; + foreach ($file->getFileList() as $item) { if ($keyword = pathinfo($item['path'], PATHINFO_EXTENSION)) { - $keywords[] = mb_strtolower($keyword); + $keyword = mb_strtolower($keyword); + + if (isset($keywords[$keyword])) + { + $keywords[$keyword]++; + } + + else + { + $keywords[$keyword] = 1; + } } } - $keywords = array_unique($keywords); - sort($keywords); + arsort($keywords); // Push torrent $torrents[] = @@ -401,16 +411,26 @@ class TorrentController extends AbstractController // Generate keywords by extension $keywords = []; + foreach ($file->getFileList() as $item) { if ($keyword = pathinfo($item['path'], PATHINFO_EXTENSION)) { - $keywords[] = mb_strtolower($keyword); + $keyword = mb_strtolower($keyword); + + if (isset($keywords[$keyword])) + { + $keywords[$keyword]++; + } + + else + { + $keywords[$keyword] = 1; + } } } - $keywords = array_unique($keywords); - sort($keywords); + arsort($keywords); // Push torrent $torrents[] = diff --git a/templates/default/torrent/list.html.twig b/templates/default/torrent/list.html.twig index 27dcb2b..8c3b35e 100644 --- a/templates/default/torrent/list.html.twig +++ b/templates/default/torrent/list.html.twig @@ -13,7 +13,7 @@ {% if torrents %} {% for torrent in torrents %} -