BUG Cleaner handling of querystring arguments when selecting locale

When selecting and redirecting to various locales (either by PHP or through javascript) url injection of the querystring argument "locale" acted poorly. Repeated changes of locale using the dropdown would disfigure the querystring into forms like "?&&&&&locale=en_NZ" or "?locale=en_NZ&" (with no conjoined querystring arguments).

This fix adds some more robust logic and cleaner handling of urls.