<commit_before><?php

require_once '../includes/master.inc.php';

if (!isset($_GET['page']))
    redirect('../error/404.php');

$page = $_GET['page'];

if ($page == 'map') {
    if (isset($_GET['subpage']) && !empty($_GET['subpage'])) {
        $subpage = $_GET['subpage'];

        if ($subpage == 'ash-park-district') {

        } else if ($subpage == 'commercial-district') {

        } else if ($subpage == 'cornell-district') {

        }
        else
            redirect('../error/404.php');
    }
    else {
        $title = "MVHPC :: Map of Mount Vernon";
        $id = 0;
        // Old district info
        // $title = "MVHPC :: Districts";
        // $id = 4;
    }
} else if ($page == 'archives') {
    if (isset($_GET['subpage']) && !empty($_GET['subpage'])) {
        $subpage = $_GET['subpage'];

        if ($subpage == 'documents') {
            $title = "MVHPC :: Documents";
            $id = 5;
        } else if ($subpage == 'images') {
            $title = "MVHPC :: Images";
            $id = 6;
        }
        else
            redirect('../error/404.php');
    }
    else {
        $title = "MVHPC :: Archives";
        $id = 2;
    }
} else if ($page == 'about-us') {
    if (isset($_GET['subpage']) && !empty($_GET['subpage'])) {
        $subpage = $_GET['subpage'];

        if ($subpage == 'links') {
            $title = "MVHPC :: Links";
            $id = 8;
        } else if ($subpage == 'design-review') {
            $title = "MVHPC :: Design Review";
            $id = 7;
        }
        else
            redirect('../error/404.php');
    }
    else {
        $title = "MVHPC :: About Us";
        $id = 3;
    }
} else {
    redirect('../error/404.php');
}

  $level = '../';
  include '../shared/header.php';

  // if $id exists, load page from database
  if ($id != 0) {
  $db = Database::getDatabase();
  $row = $db->getRow("SELECT * FROM pages WHERE id = '$id'");
  echo $row['data'];
  }

  // otherwise, load a file to display content
  else {
  if ($page == 'map') {
  include 'map.php';
  }
  }

  include '../shared/footer.php';

?><commit_msg>refactor page controller for additions to come<commit_after><?php

require_once '../includes/master.inc.php';

if (!isset($_GET['page']))
  redirect('../error/404.php');

// get page and subpage (if applicable)
$page = $_GET['page'];
$subpage = NULL;
if (isset($_GET['subpage']) && !empty($_GET['subpage'])) {
  $subpage = $_GET['subpage'];
}

if ($page == 'map') {
  if ($subpage == NULL) {
      $title = 'MVHPC :: Map of Mount Vernon';
      $id = 0;

  } else if ($subpage == 'ash-park-district') {
      

  } else if ($subpage == 'commercial-district') {
      

  } else if ($subpage == 'cornell-district') {
      

  } else {
      redirect('../error/404.php');
  }

} else if ($page == 'archives') {
  if ($subpage == NULL) {
      $title = 'MVHPC :: Archives';
      $id = 2;

  } else if ($subpage == 'documents') {
      $title = 'MVHPC :: Documents';
      $id = 0;

  } else if ($subpage == 'images') {
      $title = 'MVHPC :: Images';
      $id = 6;

  } else {
      redirect('../error/404.php');
  }

} else if ($page == 'about-us') {
  if ( $subpage == NULL) {
      $title = 'MVHPC :: About Us';
      $id = 3;

  } else if ($subpage == 'links') {
      $title = 'MVHPC :: Links';
      $id = 8;
  } else if ($subpage == 'design-review') {
      $title = 'MVHPC :: Design Review';
      $id = 7;
  } else {
      redirect('../error/404.php');
  }

} else {
    redirect('error/404.php');
}

$level = '../';
include '../shared/header.php';

// if $id exists, load page from database
if ($id != 0) {
  $db = Database::getDatabase();
  $row = $db->getRow("SELECT * FROM pages WHERE id = '$id'");
  echo $row['data'];
}

// otherwise, load a file to display content
else {
  if ($page == 'map') {
      include 'map.php';

  } else if ($subpage == 'documents') {
      include 'documents.php';
  }
}

include '../shared/footer.php';

?>
{'fraction_non_alphanumeric': 0.21473790833122308, 'fraction_numerical': 0.011901747277791846, 'mean_word_length': 2.100470957613815, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3069087', 'n_tokens_mistral': 1424, 'n_tokens_neox': 1333, 'n_words': 325}