diff options
author | ArthurHoaro <arthur@hoa.ro> | 2018-05-19 15:47:55 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2018-05-19 15:47:55 +0200 |
commit | f28396a2f82fe61af05f19c1df367f4c660655ab (patch) | |
tree | 85e6fdc854e7ca50f280318a630d70a1997d1fd4 /application/LinkDB.php | |
parent | 73da3a269bd3a636b4764f858e42dcc096e5e0a5 (diff) | |
download | Shaarli-f28396a2f82fe61af05f19c1df367f4c660655ab.tar.gz Shaarli-f28396a2f82fe61af05f19c1df367f4c660655ab.tar.zst Shaarli-f28396a2f82fe61af05f19c1df367f4c660655ab.zip |
Fix order of tags with the same number of occurrences
Fixes #1142
Diffstat (limited to 'application/LinkDB.php')
-rw-r--r-- | application/LinkDB.php | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/application/LinkDB.php b/application/LinkDB.php index c1661d52..ce53f200 100644 --- a/application/LinkDB.php +++ b/application/LinkDB.php | |||
@@ -458,8 +458,10 @@ You use the community supported version of the original Shaarli project, by Seba | |||
458 | $tags[$caseMapping[strtolower($tag)]]++; | 458 | $tags[$caseMapping[strtolower($tag)]]++; |
459 | } | 459 | } |
460 | } | 460 | } |
461 | // Sort tags by usage (most used tag first) | 461 | $keys = array_keys($tags); |
462 | arsort($tags); | 462 | $tmpTags = array_combine($keys, $keys); |
463 | // We sort tags by DESC occurrences, then ASC alphabetically for equal values. | ||
464 | array_multisort($tags, SORT_DESC, $tmpTags, SORT_ASC, $tags); | ||
463 | return $tags; | 465 | return $tags; |
464 | } | 466 | } |
465 | 467 | ||