Make sure that we can access the variables we need.

Change-Id: I9e973b076dc59d557e6bc60ce3456f54726e8c93
diff --git a/tools/wg/ecd.php b/tools/wg/ecd.php
index 0f41c6e..6973d74 100755
--- a/tools/wg/ecd.php
+++ b/tools/wg/ecd.php
@@ -9,7 +9,6 @@
  * SPDX-License-Identifier: EPL-2.0
  */
 
-
 require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.class.php");
 require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/nav.class.php");
 require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/menu.class.php");
@@ -36,8 +35,7 @@
 
 <?php
 function includeContent($wg) {
-
-	$Nav->addNavSeparator("Previous Reports", null);
+	global $Nav;
 	$dates = array();
 	foreach(glob("/home/data/httpd/writable/projects/{$wg}-*.html") as $file) {
 		$matches = array();
@@ -45,11 +43,14 @@
 			$dates[$matches['date']] = $matches['date']; // eliminate duplicates
 		}
 	}
-	krsort($dates);
-	foreach($dates as $date) {
-		$Nav->addCustomNav("{$date}", "?date={$date}", "_self", 2);
-	}
 
+	if ($dates) {
+		$Nav->addNavSeparator("Previous Reports", null);
+		krsort($dates);
+		foreach($dates as $date) {
+			$Nav->addCustomNav("{$date}", "?date={$date}", "_self", 2);
+		}
+	}
 	if (isset($_GET['date'])) {
 		$date = date('Y-m-d', strtotime($_GET['date']));
 		// We just want the first one that we find.