From 1e06a2f69a715d1f503a6e3503aa9d601ee68b64 Mon Sep 17 00:00:00 2001 From: Sanpi Date: Tue, 29 Oct 2024 08:21:13 +0100 Subject: [PATCH] Fixes subtract with overflow --- src/html.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/html.rs b/src/html.rs index 533e893..d30f297 100644 --- a/src/html.rs +++ b/src/html.rs @@ -14,7 +14,7 @@ pub fn pager(pager: &crate::Pager, config: &crate::pager::Config) -> String { } else if pager.page >= last_page - config.ellipsis { (last_page - (config.ellipsis + 1), last_page) } else { - let half = (config.ellipsis - 1) / 2; + let half = config.ellipsis.saturating_sub(1) / 2; (pager.page - half, pager.page + half) };