-for (my $i=1;$i <=length($filter);$i++) {
- $sth->execute(substr($filter,0,$i));
- my $line = $sth->fetchrow_hashref;
- push @hierarchy_loop,$line;
+if ($filter eq '' and $level == 1) {
+ # we're starting from the top
+ $have_hierarchy = 1 if @level_loop;
+ unless (@level_loop) {
+ $sth->execute(1, "%");
+ while (my $line = $sth->fetchrow_hashref) {
+ $line->{description} =~ s/\((.*)\)//g;
+ push @level_loop,$line;
+ }
+ }
+} else {
+ $sth = $dbh->prepare("SELECT * FROM browser where classification=?");
+ for (my $i=1;$i <=length($filter);$i++) {
+ $sth->execute(substr($filter,0,$i));
+ my $line = $sth->fetchrow_hashref;
+ push @hierarchy_loop,$line;
+ }
+ $have_hierarchy = 1 if @hierarchy_loop;
+}
+
+# mark every third entry in level_loop
+for (my $i = 0; $i <= $#level_loop; $i++) {
+ $level_loop[$i]->{count3} = 1 if 2 == $i % 3 && $i != $#level_loop;