I updated a website to Drupal 8.9.6 version. I saw that the global variable $pager_total_items was used, but is deprecated since D8.8.0. So, I'm looking for an alternative to retrieve the total items of the pager. This was used on a Search API page.
The old code looks like this :
$variables['count_results'] = empty($GLOBALS['pager_total_items']) ? 0 : $GLOBALS['pager_total_items'];
And now, looking this change record : https://www.drupal.org/node/2779457 I try to replace this like this :
/** @var \Drupal\Core\Pager\PagerManager $pagerManager */ $pagerManager = \Drupal::service('pager.manager'); dpm($pagerManager->getPager());
This renders nothing in the dpm(), so no Pager was found. It appears that Search API doesn't use a Pager...