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
1 changed files with 4 additions and 2 deletions

View File

@ -458,8 +458,10 @@ You use the community supported version of the original Shaarli project, by Seba
$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;
}