Location: PHPKode > projects > mediaIndex > includes/filePager.php
<?php
$dirpath = dirname($GLOBALS['file']->path);
$dir = new dir($dirpath);
$files = $dir->getFiles();
$filenames = array();
foreach ($files as $file) {
    $filenames[] = $file->filename;
}
$key = array_search($GLOBALS['file']->filename,$filenames);
if (@!$prev = $filenames[$key-1])
    $prev = $filenames[count($filenames)-1];
if (@!$next = $filenames[$key+1])
    $next = $filenames[0];

echo "<div class=\"pagination\">\n";
echo "<a href=\"?file="._encodeuri($dirpath.'/'.$prev)."\">&laquo; {$prev}</a>&nbsp;|&nbsp;";
echo "<a href=\"?file="._encodeuri($dirpath.'/'.$next)."\">{$next} &raquo;</a>";
echo "</div>\n";
?>
Return current item: mediaIndex