diff options
author | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-02-27 15:30:42 +0100 |
---|---|---|
committer | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-02-27 15:30:42 +0100 |
commit | d32477f82bca6042ddccd6bbce1cc804927a89a9 (patch) | |
tree | 0f5d399ff552407d55b407b13f9bc2988c97bfa3 /lib/JWebmail | |
parent | eddd009cd885093cb79e085c3499bdd52882e8b8 (diff) |
Separate name space for pagination
Diffstat (limited to 'lib/JWebmail')
-rw-r--r-- | lib/JWebmail/Plugin/Helper.pm | 12 |
1 files changed, 6 insertions, 6 deletions
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, |