Fix JFG-378
Fix JFG-380
Fix right encode url. Add an ability to use custom percentiles in trends.