Fix some minor warning issues (index outside range etc.)
Fix some minor warning issues (index outside range etc.)

--- a/include/common-request.inc.php
+++ b/include/common-request.inc.php
@@ -33,10 +33,18 @@
 if (isset($_REQUEST['suburb'])) {
     $suburb = $_REQUEST['suburb'];
 }
-$pageKey = filter_var($_REQUEST['pageKey'], FILTER_SANITIZE_NUMBER_INT);
-$lat = filter_var($_REQUEST['lat'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
-$lon = filter_var($_REQUEST['lon'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
-$max_distance = filter_var($_REQUEST['radius'], FILTER_SANITIZE_NUMBER_INT);
+if (isset($_REQUEST['pageKey'])) {
+    $pageKey = filter_var($_REQUEST['pageKey'], FILTER_SANITIZE_NUMBER_INT);
+}
+if (isset($_REQUEST['lat'])) {
+    $lat = filter_var($_REQUEST['lat'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
+}
+if (isset($_REQUEST['lon'])) {
+    $lon = filter_var($_REQUEST['lon'], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
+}
+if (isset($_REQUEST['radius'])) {
+    $max_distance = filter_var($_REQUEST['radius'], FILTER_SANITIZE_NUMBER_INT);
+}
 if (isset($_REQUEST['numberSeries'])) {
     $numberSeries = filter_var($_REQUEST['numberSeries'], FILTER_SANITIZE_NUMBER_INT);
 }

--- a/include/common-template.inc.php
+++ b/include/common-template.inc.php
@@ -42,7 +42,7 @@
 }
 
 function include_header($pageTitle, $pageType, $opendiv = true, $geolocate = false, $datepicker = false) {
-    global $basePath, $serviceAlertsEnabled;
+    global $basePath, $GTFSREnabled;
     echo '
 <!DOCTYPE html> 
 <html lang="en">
@@ -179,9 +179,11 @@
         }
         if ($GTFSREnabled) {
             $serviceAlerts = getServiceAlertsAsArray("agency", "0");
-            foreach ($serviceAlerts['entity'] as $entity) {
-                echo "<div id='servicewarning'>" . date("F j, g:i a", strtotime($entity['alert']['active_period'][0]['start'])) . " to " . date("F j, g:i a", strtotime($entity['alert']['active_period'][0]['end'])) . "{$entity['alert']['header_text']['translation'][0]['text']}<br>Warning: {$entity['alert']['description_text']['translation'][0]['text']} 
-			<br><a href='{$entity['alert']['url']['translation'][0]['text']}'>Source</a>  </div>";
+            if (isset($serviceAlerts['entity']) && sizeof($serviceAlerts['entity']) > 0) {
+                foreach ($serviceAlerts['entity'] as $entity) {
+                    echo "<div id='servicewarning'>" . date("F j, g:i a", strtotime($entity['alert']['active_period'][0]['start'])) . " to " . date("F j, g:i a", strtotime($entity['alert']['active_period'][0]['end'])) . "{$entity['alert']['header_text']['translation'][0]['text']}<br>Warning: {$entity['alert']['description_text']['translation'][0]['text']} 
+                            <br><a href='{$entity['alert']['url']['translation'][0]['text']}'>Source</a>  </div>";
+                }
             }
         }
     }

file:a/trip.php -> file:b/trip.php
--- a/trip.php
+++ b/trip.php
@@ -69,7 +69,7 @@
 $tripStopTimes = getTimeInterpolatedTrip($tripid);
 echo '<li data-role="list-divider">' . $tripStopTimes[0]['arrival_time'] . ' to ' . $tripStopTimes[sizeof($tripStopTimes) - 1]['arrival_time'] . ' ' . $trip['route_long_name'] . ' (' . ucwords($tripStopTimes[0]['service_id']) . ')</li>';
 foreach ($tripStopTimes as $key => $tripStopTime) {
-    if (($tripStopTimes[$key]["stop_name"] != $tripStopTimes[$key + 1]["stop_name"]) || $key + 1 >= sizeof($tripStopTimes)) {
+    if ($key + 1 > sizeof($tripStopTimes) || ($tripStopTimes[$key]["stop_name"] != $tripStopTimes[$key + 1]["stop_name"])) {
         echo '<li>';
         if (!startsWith($tripStopTime['stop_code'], "Wj"))
             echo '<img src="css/images/time.png" alt="Timing Point" class="ui-li-icon">';