Setting URL information in session in order to avoid hitting the DB
Adding dev settings in configuration.php
Fixing query + fixing PHP warning
Adding comments + adding typehint, fixing PHP warnings