From d2799b104f9541f9ef47445f07c3bfadca7b5b7e Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 19 Nov 2012 15:39:18 +0100 Subject: [PATCH] Controller-Paginate-Helfer: 'aktuelle Seite' auf maximale Seitenanzahl begrenzen Fixt #2069. --- SL/Controller/Helper/Paginated.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SL/Controller/Helper/Paginated.pm b/SL/Controller/Helper/Paginated.pm index 11eddd32d..1683aada0 100644 --- a/SL/Controller/Helper/Paginated.pm +++ b/SL/Controller/Helper/Paginated.pm @@ -7,6 +7,8 @@ our @EXPORT = qw(make_paginated get_paginate_spec get_current_paginate_params _s use constant PRIV => '__paginatedhelper_priv'; +use List::Util qw(min); + my %controller_paginate_spec; sub make_paginated { @@ -60,7 +62,8 @@ sub get_current_paginate_params { : (); my $calculated_params = "SL::DB::Manager::$spec->{MODEL}"->paginate(%paginate_params, args => \%paginate_args); %paginate_params = ( - %paginate_params, + page => min($paginate_params{page}, $calculated_params->{max}), + per_page => $paginate_params{per_page}, num_pages => $calculated_params->{max}, common_pages => $calculated_params->{common}, ); -- 2.20.1