Make sure urls encode spaces, disable google analytics on localhost
Make sure urls encode spaces, disable google analytics on localhost

--- a/include/common-template.inc.php
+++ b/include/common-template.inc.php
@@ -129,7 +129,7 @@
 
 </script> ";
 	}
-	echo '
+	if (!isDebugServer()) echo '
 <script type="text/javascript">'."
 
   var _gaq = _gaq || [];
@@ -145,7 +145,8 @@
 s.parentNode.insertBefore(ga, s);
   })();
 
-</script></head>".'
+</script>";
+echo '</head>
 <body>
     <div id="skip">
     <a href="#maincontent">Skip to content</a>
@@ -176,7 +177,7 @@
 	}
 	echo '<div id="footer"><a href="about.php">About/Contact Us</a>&nbsp;<a href="feedback.php">Feedback/Bug Report</a></a>';
 	echo '</div>';
-        if (!isDebug()) {
+        if (!isDebugServer()) {
          $googleAnalyticsImageUrl = googleAnalyticsGetImageUrl();
   echo '<img src="' . $googleAnalyticsImageUrl . '" />';
     }

file:a/trip.php -> file:b/trip.php
--- a/trip.php
+++ b/trip.php
@@ -40,7 +40,7 @@
 	echo '<a href="trip.php?tripid=' . $othertrip[1] . "&routeid=" . $routeid . '">' . midnight_seconds_to_time($othertrip[0]) . '</a> ';
 }
 echo '</p><p><h2>Other directions/timing periods:</h2> ';
-$url = $APIurl . "/json/routesearch?routeshortname=" . $trips[1]->route_short_name;
+$url = $APIurl . "/json/routesearch?routeshortname=" . rawurlencode($trips[1]->route_short_name);
 $json = json_decode(getPage($url));
 foreach ($json as $row) {
 	if ($row[0] != $routeid) echo '<a href="trip.php?routeid=' . $row[0] . '">' . $row[2] . ' (' . ucwords($row[3]) . ')</a> ';