diff --git a/web/api.php b/web/api.php
index 9f6d6e27701d821d14729dc7b89ed6f67edf43b6..1d68c02d4cd8c0e8601d318d9c5471e3581418e6 100644
--- a/web/api.php
+++ b/web/api.php
@@ -124,6 +124,7 @@ class Timeline {
     if (php_sapi_name() === "cli") {
         $this->debug = TRUE;
         $this->id = $_SERVER['argv'][1] ?? NULL;
+        $this->debug("id is {$this->id}");
       }
       else {
         // Might come via GET or POST.
@@ -134,8 +135,8 @@ class Timeline {
 
   private function parseId() {
     // The id might have a trailing * to indicate wildcard.
-    $id = $this->id || '';
-    if (preg_match('/^([a-zA-Z0-9]+)?([*])$/', trim($id), $matches)) {
+    $id = $this->id ?? '';
+    if (preg_match('/^([a-zA-Z0-9]+)?([*])$/', $id, $matches)) {
       $this->debug(print_r($matches, TRUE));
       $this->wildcard = $matches[2] ?? FALSE;
       $this->id = $matches[1];