analytics - sanitizing a bit user-provided parameters

The current code should be looked more thoroughly, I'm not happy with
the current fix, and I might have forgotten some holes.
analytics - refactor/rewrite of the data access logic (#566)

- Fixing 2 potential SQL injections (via provided properties or
  filters).
- Rewriting queries to improve querying performances (credits to
  @fvanderbiest for the optimization).
Merge branch 'fix_sql_injection_analytics' into 14.01