htmlreport: stats: sort primary by occurrences but if several IDs occur equally often, sort them alphabetically.