Code Duplication    Length = 4-5 lines in 2 locations

advancedsearch.php 2 locations

@@ 202-206 (lines=5) @@
199
        foreach ($searchresults as $result) {
200
            if ($y < $limit && $page == 1) {
201
                echo '<div class="itemTitle"><a href="' . $result['link'] . '">' . $result['title'] . '</a></div><div class="itemText">' . $result['description'] . '</div><hr>';
202
                if ($y < $limit && $y > 0) {
203
                    $items_arr_text .= ',' . $result['itemid'] . '';
204
                } else {
205
                    $items_arr_text = $result['itemid'];
206
                }
207
                ++$y;
208
            } elseif ($y < $limit && $y > 0) {
209
                $items_arr_text .= ',' . $result['itemid'] . '';
@@ 208-211 (lines=4) @@
205
                    $items_arr_text = $result['itemid'];
206
                }
207
                ++$y;
208
            } elseif ($y < $limit && $y > 0) {
209
                $items_arr_text .= ',' . $result['itemid'] . '';
210
                ++$y;
211
            } elseif ($y < $limit && $y == 0) {
212
                $items_arr_text = $result['itemid'];
213
                ++$y;
214
            } elseif ($y == $limit) {