From 6a9a312b003c783b839bd5e8bd9ff8041a3024f8 Mon Sep 17 00:00:00 2001 From: yggverse Date: Mon, 11 Aug 2025 19:48:00 +0300 Subject: [PATCH] hide pagination totals on empty response --- src/main.rs | 14 ++++++++------ templates/index.html.tera | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index b7a0641..91cc5f0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -94,12 +94,14 @@ fn index( } }) .collect::>(), - pagination_totals: format!( - "Page {} / {} ({total} {} total)", - page.unwrap_or(1), - (total as f64 / public.default_limit as f64).ceil(), - total.plurify(&["torrent", "torrents", "torrents"]) - ), + pagination_totals: if total > 0 { + Some(format!( + "Page {} / {} ({total} {} total)", + page.unwrap_or(1), + (total as f64 / public.default_limit as f64).ceil(), + total.plurify(&["torrent", "torrents", "torrents"]) + )) + } else { None }, search }, )) diff --git a/templates/index.html.tera b/templates/index.html.tera index fcd91a7..9d79d62 100644 --- a/templates/index.html.tera +++ b/templates/index.html.tera @@ -29,5 +29,5 @@ {% endif %} {% if next %}Next{% endif %} {% if back %}Back{% endif %} - {{ pagination_totals }} + {% if pagination_totals %}{{ pagination_totals }}{% endif %} {% endblock content %} \ No newline at end of file