X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;ds=sidebyside;f=WebPac.pm;h=872aec030f68dfd2262b8d91fb62293710b8be71;hb=HEAD;hp=e28dbbceb227b361756a853eeb121897bf56282b;hpb=ed651b4d838e3f8f72e378d3417012f76f0f2479;p=webpac diff --git a/WebPac.pm b/WebPac.pm index e28dbbc..872aec0 100644 --- a/WebPac.pm +++ b/WebPac.pm @@ -63,6 +63,10 @@ sub suff2file($$$$) { return $tpl if (! $base_path); + #warn "base_path: $base_path, p: $p, path: $path, tpl: $tpl\n"; + + $p =~ s#/[^/]*$##; + # strip everything to and including base path, leaving only # additional (virtual) path if ($base_path eq "/") { @@ -139,16 +143,37 @@ sub make_pager($$$) { # my ($pager_prev,$pager_next, $pager_jump) = ('','',''); - my $nav_fmt=qq{ %s }; + sub url_with_params { + my ($q,$text) = @_; + my %param = $q->Vars; + my @p; + foreach my $p ( keys %param ) { + my $v = $param{$p}; + next unless defined $v and length($v) > 0; + if ( $v =~ m{\0} ) { + push @p, $p . '=' . my_unac_string($CHARSET, $_) + foreach (split(/\0/, $v )); + } else { + push @p, $p . '=' . my_unac_string($CHARSET, $v); + } + } + + return + qq{ $text }; + } if ($pager->current_page() > $pager->first_page) { $q->param('PAGER_offset', $pager->current_page - 1); - $pager_prev .= sprintf($nav_fmt,$q->url(-relative=>1, -query=>1),'<<'); + $pager_prev .= url_with_params( $q, '<<'); } if ($pager->previous_set) { $q->param('PAGER_offset', $pager->previous_set); - $pager_prev .= sprintf($nav_fmt,$q->url(-relative=>1, -query=>1),'..'); + $pager_prev .= url_with_params( $q,'..'); } @@ -158,18 +183,18 @@ sub make_pager($$$) { $pager_jump .= "$p "; } else { $q->param('PAGER_offset', $p); - $pager_jump .= sprintf($nav_fmt,$q->url(-relative=>1, -query=>1),$p); + $pager_jump .= url_with_params($q,$p); } } if ($pager->next_set) { $q->param('PAGER_offset', $pager->next_set); - $pager_next .= sprintf($nav_fmt,$q->url(-relative=>1, -query=>1),'..'); + $pager_next .= url_with_params($q,'..'); } if ($pager->current_page() < $pager->last_page) { $q->param('PAGER_offset', $pager->current_page + 1); - $pager_next .= sprintf($nav_fmt,$q->url(-relative=>1, -query=>1),'>>'); + $pager_next .= url_with_params($q,'>>'); } $tmpl->param('PAGER_PREV', $pager_prev);