You could put the files name into an array:
$pages= Array( 'aeyrt.php','nviorf.php','vyutkd.php','oiuybd.php','poiuuy.php');
And create a function that check the current file name position and return a link to the previous or next page.
function getLink($pages,$previous = true){
$position = array_search(basename(__FILE__),$pages);
if($position==0 && $previous){
return "<a href='".$pages[count($pages)-1]."'>Previous</a>";
}
if($position==count($pages)-1 && !$previous){
return "<a href='".$pages[0]."'>Next</a>";
}
if($previous && $position!==null && $position>0){
return "<a href='".$pages[$position-1]."'>Previous</a>";
}
if($position!==null && $position<count($pages)-1){
return "<a href='".$pages[$position+1]."'>Next</a>";
}
}
I did not check if it work, but I think so ;)
I modified the funtion to be circular