Almost perfect
Two points
Why the if ($query instanceof JDatabaseQuery) ? I don´t know why, but with that if it calls the parent and so give the bad number. I don´t know why is that the check, but I disable it for testing and worked. Perfectly! :O
Another topic, I guess that this
$querylang = clone($query);
// Get the total number of content items translated languages to index.
$querylang->where('a.language = '.$this->db->q('*'));
$this->db->setQuery($querylang);
$return += ((int) $this->db->loadResult() * count($languages));
have to be inside the if (array_key_exists('language', $columns)) {, but is a not really a big deal.
Another thing
Inside the getItems, you have to divide the offset between count(languages). Why? Because you are returning count(language)*number of items, but the table you are visiting is not queried as fast.
Example
Offset = 0
Limit = 60
getItems()
- select from 0 to 60 (for jdiction I will get 180)
Offset = 180
Limit = 60
here, if I do the select from 180 with a 60 limit, I´m leaving behind the entries between 60 and 180 so... I have to divide.
And that´s all for today. I want to clean my code, maybe do some tests more and I´ll be able to try to compilate the patches done so you have them available.
Regards and thanks for your help, that last function, saved me