Index: trunk/extensions/SemanticMediaWiki/includes/storage/SMW_Query.php |
— | — | @@ -16,11 +16,11 @@ |
17 | 17 | */ |
18 | 18 | |
19 | 19 | /** |
20 | | - * Representation of queries in SMW, each consisting of a query |
21 | | - * description and various parameters. Some settings might also lead to |
| 20 | + * Representation of queries in SMW, each consisting of a query |
| 21 | + * description and various parameters. Some settings might also lead to |
22 | 22 | * changes in the query description. |
23 | 23 | * |
24 | | - * Most additional query parameters (limit, sort, ascending, ...) are |
| 24 | + * Most additional query parameters (limit, sort, ascending, ...) are |
25 | 25 | * interpreted as in SMWRequestOptions (though the latter contains some |
26 | 26 | * additional settings). |
27 | 27 | * @ingroup SMWQuery |
— | — | @@ -118,13 +118,17 @@ |
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
122 | | - * Set an offset for the returned query results. The current limit is taken into |
123 | | - * account such that the offset cannot be so large that no results are can ever |
124 | | - * be returned at all. |
| 122 | + * Set an offset for the returned query results. No offset beyond the maximal query |
| 123 | + * limit will be set, and the current query limit might be reduced in order to ensure |
| 124 | + * that no results beyond the maximal limit are returned. |
125 | 125 | * The function returns the chosen offset. |
| 126 | + * @todo The function should be extended to take into account whether or not we |
| 127 | + * are in inline mode (not critical, since offsets are usually not applicable inline). |
126 | 128 | */ |
127 | 129 | public function setOffset($offset) { |
128 | | - $this->m_offset = min($this->m_limit - 1, $offset); //select integer between 0 and current limit -1; |
| 130 | + global $smwgQMaxLimit; |
| 131 | + $this->m_offset = min($smwgQMaxLimit, $offset); //select integer between 0 and maximal limit; |
| 132 | + $this->m_limit = min($smwgQMaxLimit - $this->m_offset, $this->m_limit); // note that limit might become 0 here |
129 | 133 | return $this->m_offset; |
130 | 134 | } |
131 | 135 | |