Redirect to home when logging out on a view restricted page

Logout in the toolbar redirects to home page if the current page is not available to anonymous user

 * published page: no redirect
 * unpublished page: redirect to the home page
 * published page with login_required: redirect to the home page
 * published page with view permissions: redirect to the home page

Fix #2124
Fix #1668