$offset = intval($_GET['offset']); if ($offset < 0) { $offset = 0; } } $beginning = $count - 40 - $offset; if ($beginning < 0) { $beginning = 0; } //Beginning should never be greater than $count, for the reason that $offset is always >= 0 // Get the images $imgs = array(); $imgs = $db->getpics($offset, $boardid); // Get the boards array, to show a list for filtering $boards = array(); $boards = $db->getboard(); // No parameters means everything gets fetched $sm = sminit("adminrecentpics.tpl", null, "_admin", true); // Admin mode means NO caching. (and we provided a null id anyway) // These can be pretty big, so we're going to assign by reference. $sm->assign_by_ref("imgs", $imgs); $sm->assign_by_ref("boards", $boards); $sm->assign("board_folder", $board_folder); // name of the folder (for filtering) $sm->assign("boardlink", $boardlink); //some stuff to append for easy link creation $sm->assign("total_count", $count); // total number (for optionally showing the paging links) $sm->assign("offset", $offset); $sm->assign("offsetfwd", $offsetfwd); $sm->assign("offsetback", $offsetback);