[Plugin] Get the top10 pages view

Hi,

I’m developping a plugin which displays the top 10 pages view for a given date.

I’m doing my API call like this :


public function getTop10PageViews($idSite, $period, $date, $segment = false, $expanded = false, $idSubtable = false)
{
    $dataTable = Piwik_Actions_API::getInstance()->getPageUrls( $idSite, $period, $date, $segment, $expanded, $idSubtable);
    $dataTable->filter('Limit', array(0, 10));

    return $dataTable;
}

It returns me a table with the 10 rows the most visited, but these rows includes sections row (domain.tld/section/item-name) which are not actual pages. I don’t wanna have those section’s rows, only the top 10 most viewed pages in a flat table.

How can I do it?

Add &flat=1 in the API request

And then how do I remove this parameter?
Using JavaScript?