<?php

require_once "../includes/initialize.php";
/**
 * First I need to get the page number and in the event it is empty, like on
 * first getting to the site.
 * @var int
 */
$page = !empty($_GET['page']) ? (int) $_GET['page'] : 1;
$per_page = 5;
$count = Photograph::count_all();
// $photos = Photograph::find_all();
$pagination = new Pagination($page, $per_page, $count);
$sql = $pagination->build_sql("photographs");
$photos = Photograph::find_by_sql($sql);
?>

<?php 
include_layout_template("header.php");
?>

<h2>Photographs</h2>
<?php 
echo output_message($message);
?>
<div>
    <?php 
foreach ($photos as $photo) {
    ?>
    <div id="photo">
        <figure>