I'm trying to get a list of all the products in the store using the product-collections but it doesn't respect the page and page-size params. I'm using the sample data and have 174 products in my store but irrespective of the page number and size supplied when querying the collection:
/** @var Store $store */
$store = $this->_storeManager->getStore(true);
/** @var \Magento\Catalog\Model\ResourceModel\Product\Collection $collection */
$collection = $this->getCollection($store);
$collection = $collection->addAttributeToSelect('*');
$collection = $collection->setCurPage(100);
$collection = $collection->setPageSize(1000);
$collection = $collection->load();
var_dump($collection->getSize());
//var_dump($collection->count());
//var_dump(count($collection->getData()));
I've tried to output the size of the collection after querying it but the number of results are incorrect.