1.9.x: Fix unintentional wildcard search on user_list

This branch does 2 things:

 * Refactor the duplicated code in user_list used to query users count and data.
 * Fix https://support.chamilo.org/issues/6735 – The keyword parameter was not being filtered.

With respect to the question in the ticket if we should allow users to include a wildcard in their search queries, I believe this would be the wrong approach.

Search should be inclusive by default and users should not need to know, or include, any SQL or globe pattern trick.

I kept the refactor in two stages to ease review. Consider commit a2ab96f as bonus refactoring :-).