= $limit || $offset > 0){ ?>
0) { $prevoffset = $offset - $limit; if ($prevoffset < 0) $prevoffset = 0; $prevurl = $baseurl; if (substr_count($baseurl,'?')) { $prevurl .= "&{$word}=" . $prevoffset; } else { $prevurl .= "?{$word}=" . $prevoffset; } echo "« ". elgg_echo("previous") ." "; } if ($offset > 0 || $offset < ($count - $limit)) { $currentpage = round($offset / $limit) + 1; $allpages = ceil($count / $limit); $i = 1; $pagesarray = array(); while ($i <= $allpages && $i <= 4) { $pagesarray[] = $i; $i++; } $i = $currentpage - 2; while ($i <= $allpages && $i <= ($currentpage + 2)) { if ($i > 0 && !in_array($i,$pagesarray)) $pagesarray[] = $i; $i++; } $i = $allpages - 3; while ($i <= $allpages) { if ($i > 0 && !in_array($i,$pagesarray)) $pagesarray[] = $i; $i++; } sort($pagesarray); $prev = 0; foreach($pagesarray as $i) { if (($i - $prev) > 1) { echo "..."; } $counturl = $baseurl; $curoffset = (($i - 1) * $limit); if (substr_count($baseurl,'?')) { $counturl .= "&{$word}=" . $curoffset; } else { $counturl .= "?{$word}=" . $curoffset; } if ($curoffset != $offset) { echo " {$i} "; } else { echo " {$i} "; } $prev = $i; } } if ($offset < ($count - $limit)) { $nextoffset = $offset + $limit; if ($nextoffset >= $count) $nextoffset--; $nexturl = $baseurl; if (substr_count($baseurl,'?')) { $nexturl .= "&{$word}=" . $nextoffset; } else { $nexturl .= "?{$word}=" . $nextoffset; } echo " " . elgg_echo("next") . " »"; } ?>