LPS-37616 Inconsistent behavior with site creation from site templates

Hi Gábor,

This issue is discovered during fixing another issue. The basic story is that formerly our DB index didn't allow to use the same template for public and private pages, but it's changed sometimes, so the behavior became different when select the same template for both public and private pages or just for one of them at a time.

Please review this and push it forward.
If you have any concerns, please let me know.

Vilmos