// Get and set page var
if( isset($_GET['page'])){$page = $_GET['page'];}else{$page = "1";}
if ($handle1 = opendir($root2folder . '/images/')) {
$imageCount = 0;
while (false !== ($file = readdir($handle1))) {
if ($file != "." && $file != ".." && $file !="Thumbs.db") {
$imageCount++;
}
}
closedir($handle1);
}
// Create vars for pagination
$imageListStart = ($page * $imageListImageCount - $imageListImageCount);
$imageListStop = ($imageListStart + $imageListImageCount);
$numberOfPages = ceil($imageCount / $imageListImageCount);
// Draw pagination
if ($numberOfPages > 1){
// echo 'showing ' . ($imageListStart + 1) . ' through ' . $imageListStop . ' of ' . $imageCount;
echo "\n\n" . '' . "\n\n";
}
// Display image list
if ($handle2 = opendir($root2folder . 'images/')) {
$i = 1;
$cnt = 0;
while (false !== ($file = readdir($handle2))) {
if ($file != "." && $file != ".." && $file !="Thumbs.db") {
if(($cnt>=$imageListStart)&&($cnt<$imageListStop)){
echo '
' . "\n" .
'

' . "\n" .
'
' . "\n" .
'
' . "\n\n";
}
$i++;
$cnt++;
}
}
closedir($handle2);
}
// Draw pagination
if ($numberOfPages > 1){
// echo 'showing ' . ($imageListStart + 1) . ' through ' . $imageListStop . ' of ' . $imageCount;
echo "\n\n" . '' . "\n\n";
}
?>