add some helper functions from https://github.com/meisterluk/unfuck.php/

thanks meisterluk
move database functions to AbstractDatabaseController.

PageController now works with all parameters and order by parameters.