From d32477f82bca6042ddccd6bbce1cc804927a89a9 Mon Sep 17 00:00:00 2001 From: "Jannis M. Hoffmann" Date: Mon, 27 Feb 2023 15:30:42 +0100 Subject: Separate name space for pagination --- lib/JWebmail/Plugin/Helper.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/JWebmail/Plugin') diff --git a/lib/JWebmail/Plugin/Helper.pm b/lib/JWebmail/Plugin/Helper.pm index c00ef0e..ed2c31b 100644 --- a/lib/JWebmail/Plugin/Helper.pm +++ b/lib/JWebmail/Plugin/Helper.pm @@ -244,7 +244,7 @@ sub _paginate { [_clamp(0, $page_*$page_size, $total_items-1), _clamp(0, ($page_+1)*$page_size, $total_items)] }; - my %ret = ( + my $ret = { total_items => $total_items, page_size => $page_size, @@ -256,14 +256,14 @@ sub _paginate { this_page => $page->($current_page), next_page => $page->($current_page+1), last_page => $page->($total_pages-1), - ); + }; if ($total_items) { - $ret{first_item} = $first_item; - $ret{last_item} = _clamp($first_item, $first_item+$page_size-1, $total_items-1); + $ret->{first_item} = $first_item; + $ret->{last_item} = _clamp($first_item, $first_item+$page_size-1, $total_items-1); } - return %ret; + return $ret; } sub paginate { @@ -277,7 +277,7 @@ sub paginate { $start = _clamp(0, $start, max($count-1, 0)); my $end = _clamp($start, $start+$psize, max($count, 0)); - $c->stash(_paginate( + $c->stash(pgn => _paginate( first_item => int($start/$psize)*$psize, page_size => $psize, total_items => $count, -- cgit v1.2.3