- my @pages=keys %IkiWiki::pagesources;
- return $#pages+1 if $params{pages} eq "*"; # optimisation
- my $count=0;
- foreach my $page (@pages) {
- $count++ if IkiWiki::globlist_match($page, $params{pages});
+ my @pages;
+ if ($params{pages} eq "*") {
+ @pages=keys %pagesources;
+ }
+ else {
+ @pages=pagespec_match_list([keys %pagesources], $params{pages}, location => $params{page});