Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Giehl <stefan@piwik.org>2018-08-13 18:19:45 +0300
committerGitHub <noreply@github.com>2018-08-13 18:19:45 +0300
commitb555e1c613b0f674d86a44850fa5907c613b8e35 (patch)
tree54edd15bb4841bc60994700f33c4f511c12f001e /plugins/Actions
parent732b8059736153cceb4c230e59e498bd1ab4bb0c (diff)
Use a stable sort method for visited pages in user profile (#13284)
* Use a stable stort method for visited pages in user profile * update tests
Diffstat (limited to 'plugins/Actions')
-rw-r--r--plugins/Actions/VisitorDetails.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/plugins/Actions/VisitorDetails.php b/plugins/Actions/VisitorDetails.php
index b770c5ac4c..d6b5ecfff8 100644
--- a/plugins/Actions/VisitorDetails.php
+++ b/plugins/Actions/VisitorDetails.php
@@ -266,7 +266,6 @@ class VisitorDetails extends VisitorDetailsAbstract
public function finalizeProfile($visits, &$profile)
{
- arsort($this->visitedPageUrls);
$profile['visitedPages'] = [];
foreach ($this->visitedPageUrls as $visitedPageUrl => $count) {
@@ -276,6 +275,14 @@ class VisitorDetails extends VisitorDetailsAbstract
];
}
+ usort($profile['visitedPages'], function($a, $b) {
+ if ($a['count'] == $b['count']) {
+ return strcmp($a['url'], $b['url']);
+ }
+
+ return strcmp($b['count'], $a['count']);
+ });
+
$this->handleSiteSearches($profile);
$this->handleAveragePageGenerationTime($profile);
}