Bugfixes on the pages controller and model. Tests added for PagesAdmin.