LPS-31985 Refine solution provided by LPS-23365

Hi Dani,

Change 359f7e07704163c1010366047000b028d4e69ba1 - which was simplified by @sergiogonzalez  - has been originally intended for supporting logging out from a virtual host site with private pages only.

In case of LPS-31985, in that block of code, the guest layout is being picked, which is wrong; it should only be used in such scenarios if we could not have determined a default layout so far (layout == null) or we're currently visiting a private-page-only site in an unauthenticated way.

Cheers,
Laci.