$Data::Dumper::Indent = 0;
my $U = 'OpenILS::Application::AppUtils';
-# when fetching "all" search results for staff client
-# start/end paging, fetch this many IDs at most
-my $all_recs_limit = 10000;
-
-
sub _prepare_biblio_search_basics {
my ($cgi) = @_;
$ctx->{page_size} = $limit;
$ctx->{search_page} = $page;
- # fetch the first hit from the next page
+ # fetch this page plus the first hit from the next page
if ($internal) {
- $limit = $all_recs_limit;
+ $limit = $offset + $limit + 1;
$offset = 0;
}
return Apache2::Const::OK if @$query == 0;
if ($args{internal}) {
- $limit = $all_recs_limit;
+ $limit = $offset + $limit + 1;
$offset = 0;
}
[%
IF ctx.prev_search_record;
prev_args = {};
- IF ctx.search_result_index % (ctx.page_size + 1) == 0; # first record in the page
+ IF ctx.search_page > 0 AND
+ ctx.search_result_index % ((ctx.page_size * ctx.search_page)) == 0; # first record in the page
prev_args.page = ctx.search_page - 1;
END;
ctx.prev_rec_url = mkurl(ctx.prev_search_record, prev_args, stop_parms);
[%
IF ctx.next_search_record;
next_args = {};
- IF ctx.page_size == ctx.search_result_index + 1;
+ IF (ctx.page_size * (ctx.search_page + 1)) == ctx.search_result_index + 1;
next_args.page = ctx.search_page + 1;
END;
ctx.next_rec_url = mkurl(ctx.next_search_record, next_args, stop_parms);