Backport of #1113, Fix rendering of database connection error page

I've manually backport the PR #1113 because of merging errors...

Please have look .... but it shouldn't be that different from the original commit