Fix order of tags with the same number of occurrences

Fixes #1142
This commit is contained in:
ArthurHoaro 2018-05-19 15:47:55 +02:00
parent 73da3a269b
commit f28396a2f8

View file

@ -458,8 +458,10 @@ public function linksCountPerTag($filteringTags = [], $visibility = 'all')
$tags[$caseMapping[strtolower($tag)]]++;
}
}
// Sort tags by usage (most used tag first)
arsort($tags);
$keys = array_keys($tags);
$tmpTags = array_combine($keys, $keys);
// We sort tags by DESC occurrences, then ASC alphabetically for equal values.
array_multisort($tags, SORT_DESC, $tmpTags, SORT_ASC, $tags);
return $tags;
}