Do not use array_splice twice to get the two parts of an array

A little lesson or two in the art of PHP may be forgiven.

-        $upcoming_initial = array_splice($series['upcoming'], 0, $upcoming_limit);
-        $upcoming = array_splice($series['upcoming'], $upcoming_limit);
+        // This code had two array_splice's in a row before, one to get the
+        // initial and the second to get the rest (upcoming limit as the offset
+        // with no length to get all the rest.  This was unnecessary and indeed
+        // actively harmful, because array_splice takes the array it is given
+        // by reference and *removes* what it returns from it.  Doing
+        // array_splice twice in a row without realizing it caused a bug where
+        // the next $upcoming_limit events were not shown.  In short:
+        // array_splice removes spliced elements from $upcoming for us.
+        $upcoming_initial = array_splice($upcoming, 0, $upcoming_limit);

The fine manual explains it:

https://www.php.net/array_splice

The key is that it changes the given array, it does not merely return a section of the array and leave the original array untouched, as my former self clearly thought.