It would be better if $suggestedList and (on line 341) $suggestedTitles were associative arrays.  If any of these arrays start to grow large we end up doing a lot of array scans when it would take constant time to do an array key lookup instead.