Querying Table for Index Fragmentation - Multiple Different Results for Same Index
There's a row for each level in the index (add ips.index_level to the output and you will see that there is a row for each level). 

Your query should probably simply filter out any row with a low page count (say, 1000), which will eliminate all but level 0 in most cases.