Minor code optimization

Also $data['route'] should be escaped. 
For example:
index.php?route=error/not_found\ -> "Error: You have an error in your SQL syntax; bla bla"