I made a paginator but the problem is that it shows page number on bottom when there is only one page. So I tried to add if~else but I can't get it to work. "Error: Maximum execution time of 120 seconds exceeded "
before
<div class="pagination">
<?php for($x = 1; $x <= $pages; $x++): ?>
<a href="?page=<?php echo $x; ?>"<?php if($page === $x) { echo ' class="selected" '; } ?>><?php echo $x ?></a>
<?php endfor; ?>
</div>
after
<div class="pagination">
<?php
if($pages > 1){
for($x = 1; $x <= $pages; $x++):
if($x = 1)
{
?>
<a href="?page=<?php echo $x; ?>"<?php if($page === $x) { echo ' class="selected" '; } ?>><?php echo $x ?></a>
<?php
} else {
echo '';
}
endfor;
}
?>
</div>