Made `generateNonce()` return value url safe
Made `generateNonce()` return value url safe

This change is primarly to make sure we do not have to url encode the xsrf token.

Also, the default value for the method is now 30 instead of 20. (the magic 20 number was undocumented). The magic number used in the for loop for the fallback is also replace by the length parameter value: the sorter the nonce, the more iteration we have to make to shuffle things more.

Finally the method will now throw an Exception if the length is smaller than 1.

Fixes #2567

Picked from 34a3b50d52

bauhouse/sym-todo-list,symphonycms/symphony-2,symphonycms/symphony-2,michael-e/symphony-2,jensscherbl/symphony,bauhouse/sym-todo-list,michael-e/symphony-2,jensscherbl/symphony