Create error pages structure and log errors in the database

Fix partially gh-15.
Closes gh-29.