Blank page (fatal error) on /stats/publishedSubmissions

Hello,

I have a 3.1.2.1 OJS with one journal. While trying to access /stats/publishedSubmissions, OJS renders blank page and the error I can find in the log is:

[Tue Nov 05 10:34:13.608094 2019] [php7:error] [pid 40906] [client 88.156.140.164:60305] PHP Fatal error:  Uncaught Error: Call to a member function getContextId() on null in /var/www/html/ojs/lib/pkp/classes/services/PKPStatsService.inc.php:127\nStack trace:\n#0 /var/www/html/ojs/lib/pkp/classes/services/PKPStatsService.inc.php(160): PKP\\Services\\PKPStatsService->getProperties(NULL, Array, Array)\n#1 /var/www/html/ojs/lib/pkp/pages/stats/PKPStatsHandler.inc.php(98): PKP\\Services\\PKPStatsService->getSummaryProperties(NULL, Array)\n#2 /var/www/html/ojs/lib/pkp/classes/core/PKPRouter.inc.php(390): PKPStatsHandler->publishedSubmissions(Array, Object(Request))\n#3 /var/www/html/ojs/lib/pkp/classes/core/PKPPageRouter.inc.php(231): PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(Request), Array, false)\n#4 /var/www/html/ojs/lib/pkp/classes/core/Dispatcher.inc.php(134): PKPPageRouter->route(Object(Request))\n#5 /var/www/html/ojs/lib/pkp/classes/core/PKPApplication.inc.php(252): Dispatcher->dispatch(Object(Request))\n#6 /var/www/html/ojs/index.php(68): PKPApplication->execute()\n#7 {main}\n  thrown in /var/www/html/ojs/lib/pkp/classes/services/PKPStatsService.inc.php on line 127, referer: https://***/index.php/***/submissions

Everything used to work fine on staging server - the problem persists only on production. The only thing that was done except for migration was the import of previous issues.

I’d appreciate any ideas on what might be causing the problem.