Opened 3 years ago

Closed 3 years ago

#1850 closed Bug (fixed)

Live API: loadLastVisitorDetailsFromDatabase - $offset + $limit ?

Reported by: vipsoft Owned by:
Priority: normal Milestone: Piwik 1.1
Component: Core Keywords:
Cc: Sensitive: no

Description

This looks wrong:

// increase limit by offset when visitor paginates
if(!empty($offset))
{
    $limit += (int)$offset;
}
...
    LIMIT ".(int)$limit;

Since it doesn't look like the $offset is set in the current code, this probably won't be a compat buster: remove the += statement, and change the LIMIT clause to:

    LIMIT ".(int)$offset.",".(int)$limit;

Change History (2)

comment:1 Changed 3 years ago by vipsoft (robocoder)

Or use:

    LIMIT ".(int)$limit." OFFSET ".(int)$offset;

which is compatible with PostgreSQL syntax.

comment:2 Changed 3 years ago by vipsoft (robocoder)

  • Resolution set to fixed
  • Status changed from new to closed

(In [3389]) fixes #1850

Note: See TracTickets for help on using tickets.