$block->getLoadedProductCollection() is breaking pagination - Magneto EE 1.14.2.2
<p>So our custom data layer for Magento: <a href="https://github.com/QubitProducts/UniversalVariable-Magento-Extension" rel="nofollow noreferrer">https://github.com/QubitProducts/UniversalVariable-Magento-Extension</a> works very well, but I'm having some issues on a few client sites (with Pagination showing the wrong information and have pinpointed it down to the way we are loading the product collection on category pages.</p>

<p>In short, this module puts all relevant page information into a nice JavaScript object located at window.universal_variable.</p>

<p>When on the second(or later) category page, you will see something like this: (figure 1)</p>

<p><a href="https://i.stack.imgur.com/FmpbH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FmpbH.png" alt="figure 1"></a></p>

<p>This is where the 'non magic' happens: </p>

<pre><code>&lt;?php
class QuBit_UniversalVariable_Model_Observer
{
/**
 * Observes controller_action_layout_render_before
 * @param Varien_Event_Observer $observer
 */
public function processListingData(Varien_Event_Observer $observer)
{
    /** @var QuBit_UniversalVariable_Helper_Data $helper */
    $helper = Mage::helper('qubituv');
    $layout = Mage::app()-&gt;getLayout();
    /** @var Mage_Catalog_Block_Product_List $block */
    $block = $layout-&gt;getBlock($helper-&gt;getCategoryProductListBlockName());
    if (!$block instanceof Mage_Catalog_Block_Product_List) {
        $block = $layout-&gt;getBlock($helper-&gt;getSearchProductListBlockName());
        if (!$block instanceof Mage_Catalog_Block_Product_List) {
            return;
        }
    }
    $uv = $helper-&gt;getUv();
    $listing = $uv-&gt;getListing();
    /** @var Mage_Catalog_Model_Resource_Product_Collection $collection */
    $collection = $block-&gt;getLoadedProductCollection();
    $listing['result_count'] = $collection-&gt;getSize();
    $listing['items'] = array();
    foreach($collection as $product) {
        $listing['items'][] = $uv-&gt;getProductData($product);
    }
    $toolbar = $block-&gt;getToolbarBlock();
    $listing['sort_by'] = $toolbar-&gt;getCurrentOrder() . '_' . $toolbar-&gt;getCurrentDirection();
    $listing['layout'] = $toolbar-&gt;getCurrentMode();
    $uv-&gt;setListing($listing);
 }
</code></pre>

<p>}</p>

<p><em>Source: <a href="https://github.com/QubitProducts/UniversalVariable-Magento-Extension/blob/master/app/code/community/QuBit/UniversalVariable/Model/Observer.php" rel="nofollow noreferrer">https://github.com/QubitProducts/UniversalVariable-Magento-Extension/blob/master/app/code/community/QuBit/UniversalVariable/Model/Observer.php</a></em></p>

<p>and $uv->getProductData($product); looks like this:</p>

<pre><code>/**
 * @param Mage_Catalog_Model_Product $product
 * @return array
 */
public function getProductData(Mage_Catalog_Model_Product $product)
{
    $id = $product-&gt;getId();
    if (!$this-&gt;helper()-&gt;shouldUseRealProductId()) {
        $id = $product-&gt;getSku() ? $product-&gt;getSku() : md5($id);
    }
    $data = array(
        'id' =&gt; $id,
        'url' =&gt; $product-&gt;getProductUrl(),
        'name' =&gt; $product-&gt;getName(),
        'unit_price' =&gt; (float)$product-&gt;getPrice(),
        'unit_sale_price' =&gt; (float)$product-&gt;getFinalPrice(),
        'currency' =&gt; $this-&gt;_getCurrency(),
        'description' =&gt; strip_tags($product-&gt;getShortDescription()),
        'sku_code' =&gt; $product-&gt;getSku()
    );
    if ($this-&gt;helper()-&gt;shouldShowProductStockInfo()) {
        $data['stock'] = (int)Mage::getModel('cataloginventory/stock_item')-&gt;loadByProduct($product)-&gt;getQty();
    }
    $catIndex = $catNames = array();
    $limit = 2; $k = 0;
    foreach ($product-&gt;getCategoryIds() as $catId) {
        if (++$k &gt; $limit) {
            break;
        }
        if (!isset($catIndex[$catId])) {
            $catIndex[$catId] = Mage::getModel('catalog/category')-&gt;load($catId);
        }
        $catNames[] = $catIndex[$catId]-&gt;getName();
    }
    if (isset($catNames[0])) {
        $data['category'] = $catNames[0];
    }
    if (isset($catNames[1])) {
        $data['subcategory'] = $catNames[1];
    }
    return $data;
}
</code></pre>

<p>Source: <a href="https://github.com/QubitProducts/UniversalVariable-Magento-Extension/blob/master/app/code/community/QuBit/UniversalVariable/Model/Uv.php" rel="nofollow noreferrer">https://github.com/QubitProducts/UniversalVariable-Magento-Extension/blob/master/app/code/community/QuBit/UniversalVariable/Model/Uv.php</a></p>

<p>Does anyone have any ideas on why using $block->getLoadedProductCollection() might be causing this? and whether we can add any filters to this? or another method of loading the products on a category page to populate our object.</p>

<p>Thanks!</p>