rendered paste body<?phprequire_once('db.php');$limit = 7;$query_count = "SELECT * FROM gallery";$result_count = mysql_query($query_count);$totalrows = mysql_num_rows($result_count);if(empty($page)) { $page = 1; } $limitvalue = $page * $limit - ($limit);$query = "SELECT * FROM gallery ORDER BY id DESC LIMIT $limitvalue, $limit";$result = mysql_query($query) or die("Error: " . mysql_error());if($page != 1) { $pageprev = $page--; echo '<a href="' . $_SERVER['PHP_SELF'] . '&page=' . $pageprev . '">Previous ' . $limit . '</a> ';}else{ echo 'Previous ' . $limit . ' '; }while($row = mysql_fetch_assoc($result)){ echo '<a href="' . $_SERVER['PHP_SELF'] . '?illustration=' . $row['filename'] . '"><img src="gallery/' . $row['filename'] . '/' . $row['filename'] . '-thumbnail.jpg" /></a>' . "\n"; }if(($totalrows - ($limit * $page)) > 0){ $pagenext = $page++; echo '<a href="' . $_SERVER['PHP_SELF'] . '?page=' . $pagenext . '">Next ' . $limit . '</a>';}else { echo 'Next ' . $limit;}?>